Import Geant4 4.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 16:18:25 +02:00
parent 36c080dca6
commit 921d3b1cda
3990 changed files with 185376 additions and 82884 deletions
+74 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.23 2001/06/28 15:07:28 gcosmo Exp $
$Id: History,v 1.35 2001/11/22 19:24:35 gcosmo Exp $
-------------------------------------------------------------------
=========================================================
@@ -17,6 +17,79 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
Nov 21 2001, M.Asai (event-V03-02-09)
- G4PrimaryTransformer.cc: now considering case where a primary is placed on the
boundary of the world volume. Added units.
Nov 20 2001, M.Asai (event-V03-02-08)
- Add check whether the primary vertex is inside of thw world volume.
- Move set method of position and time from G4ParticleGun to G4VPrimaryGenerator
so that G4HEPEvtInterface can accept the primary vertex position
Nov 10 2001, M.Asai (event-V03-02-07)
- Tagged.
Oct 19 2001, F. Lei
- Code changes to remove compilation warnings un gcc-2.95.2
- Added Beam option for generating accerlator beams
Oct 11 2001, G.Cosmo (event-V03-02-06)
- Replaced inclusions of ctoken.h with G4Tokenizer.hh in
G4GeneralParticleSourceMessenger.cc and G4ParticleGunMessenger.cc.
Removed comment on RW wrappers.
- Co-works with tag "globals-V03-02-03" where the STLInterface
module has been removed.
Aug 27 2001, M.Asai (event-V03-02-05)
- Convert NULL to 0 in G4EventManager.cc
Aug 17 2001, M.Asai (event-V03-02-04)
- G4EventManager.cc is debugged according to bug report 289.
July 19 2001, M.Asai (event-V03-02-03)
- Tagged
July 19 2001, F.Lei
- Most commands under G4ParticleGun class are now available under GPS
e.g..
/gun/position => /gps/position
/gun/direction => /gps/direction
/gun/energy => /gps/energy
...
- Implemented co-ordinates rotation for angular distribution. User defined
co-ordinates was an option available to user in the messenger but not
implemented internally in the older version gps.
Source angular distribution coupled with positional distribution can lead to
rather strange combinations. To avoid this I used a simple scheme in this
implementation:
- For cos-law angular distribution the default maxtheta is set to pi/2.
instead of pi. The user can of course re-set this to any number between
0 - pi.
- Added user defined histogram re-set method. After re-set user can
redefine all the histograms. To use
/gps/resethist 'histname'
- Bug fixed in generating theta, and in calculating the weight.
- Added further guidance in the messenger for the definition of pre-defined
energy distributions
Jul 18 2001, M.Asai (event-V03-02-02)
- Added a new feature for the user to increase the number of waiting stacks.
Jul 17 2001, M.Asai (event-V03-02-01)
- G4PrimaryParticle now stores the proper trackID.
Jul 13 2001, G.Cosmo (event-V03-02-00)
- Cleanup of pedantic warnings in Linux-g++ ANSI setup.
- Corrected "int" to "G4int".
- Corrected "NULL" to "0".
- Synchronised with HEAD revision after inclusion of disclaimer
liability.
Jun 28 2001, G.Cosmo (event-V03-01-01)
- Added CVS headers to G4GeneralParticleSource[.hh.cc] and
G4GeneralParticleSourceMessenger[.hh.cc].
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4ClassificationOfNewTrack.hh,v 1.3.4.1 2001/06/28 19:07:52 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4ClassificationOfNewTrack.hh,v 1.5 2001/07/19 00:14:15 asaim Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
@@ -37,10 +37,16 @@
enum G4ClassificationOfNewTrack
{
fUrgent, // put into the urgent stack
fWaiting, // put into the waiting stack
fPostpone, // postpone to the next event
fKill // kill
fUrgent=0, // put into the urgent stack
fWaiting=1, // put into the waiting stack
fPostpone=-1, // postpone to the next event
fKill=-9, // kill
//----------------------------------------------------------------
// following ENUM are available only if the user increases the
// number of waiting stacks
//----------------------------------------------------------------
fWaiting_1=11, fWaiting_2=12, fWaiting_3=13, fWaiting_4=14, fWaiting_5=15,
fWaiting_6=16, fWaiting_7=17, fWaiting_8=18, fWaiting_9=19, fWaiting_10=20
};
#endif
+2 -2
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4EvManMessenger.hh,v 1.3.4.1 2001/06/28 19:07:52 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4EvManMessenger.hh,v 1.4 2001/07/11 09:58:47 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
#ifndef G4EvManMessenger_h
+8 -8
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4Event.hh,v 1.3.4.1 2001/06/28 19:07:52 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4Event.hh,v 1.5 2001/07/13 15:01:45 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
#ifndef G4Event_h
@@ -55,8 +55,8 @@ class G4Event
inline void *operator new(size_t);
inline void operator delete(void* anEvent);
int operator==(const G4Event &right) const;
int operator!=(const G4Event &right) const;
G4int operator==(const G4Event &right) const;
G4int operator!=(const G4Event &right) const;
public: // with description
void Print() const;
@@ -98,7 +98,7 @@ class G4Event
// Returns the event ID
inline void AddPrimaryVertex(G4PrimaryVertex* aPrimaryVertex)
{
if( thePrimaryVertex == NULL )
if( thePrimaryVertex == 0 )
{ thePrimaryVertex = aPrimaryVertex; }
else
{ thePrimaryVertex->SetNext( aPrimaryVertex ); }
@@ -116,15 +116,15 @@ class G4Event
else if( i > 0 && i < numberOfPrimaryVertex )
{
G4PrimaryVertex* primaryVertex = thePrimaryVertex;
for( int j=0; j<i; j++ )
for( G4int j=0; j<i; j++ )
{
if( primaryVertex == NULL ) return NULL;
if( primaryVertex == 0 ) return 0;
primaryVertex = primaryVertex->GetNext();
}
return primaryVertex;
}
else
{ return NULL; }
{ return 0; }
}
// Returns i-th primary vertex of the event.
inline G4HCofThisEvent* GetHCofThisEvent() const
+6 -4
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4EventManager.hh,v 1.5.4.1 2001/06/28 19:07:53 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4EventManager.hh,v 1.9 2001/07/19 00:14:15 asaim Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
@@ -76,7 +76,7 @@ class G4EventManager
// This method must be exclusively invoked by G4RunManager.
private:
void StackTracks(G4TrackVector *trackVector);
void StackTracks(G4TrackVector *trackVector, G4bool IDhasAlreadySet=false);
G4Event* currentEvent;
@@ -84,7 +84,7 @@ class G4EventManager
G4TrackingManager *trackManager;
G4TrajectoryContainer *trajectoryContainer;
G4int trackIDCounter;
int verboseLevel;
G4int verboseLevel;
G4SDManager* sdManager;
G4PrimaryTransformer* transformer;
G4bool tracking;
@@ -132,6 +132,8 @@ class G4EventManager
// Set and get methods for user action classes. User action classes
// which should belong to the other managers will be sent to the
// corresponding managers.
void SetNumberOfAdditionalWaitingStacks(G4int iAdd)
{ trackContainer->SetNumberOfAdditionalWaitingStacks(iAdd); }
public: // with description
inline G4int GetVerboseLevel()
@@ -31,8 +31,8 @@
// Customer: ESA/ESTEC
//
///////////////////////////////////////////////////////////////////////////////
// $Id: G4GeneralParticleSource.hh,v 1.3 2001/06/29 08:05:59 gcosmo Exp $
// GEANT4 tag $Name: event-V03-01-01 $
// $Id: G4GeneralParticleSource.hh,v 1.7 2001/10/19 16:48:28 flei Exp $
// GEANT4 tag $Name: geant4-04-00 $
///////////////////////////////////////////////////////////////////////////////
//
// Class Description:
@@ -336,7 +336,7 @@
//
// void SetVerbosity(G4int)
// Sets the verbosity level.
//
///////////////////////////////////////////////////////////////////////////////
//
//
@@ -396,6 +396,9 @@ public:
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);
@@ -403,6 +406,7 @@ public:
void GenerateRotationMatrices();
// the following routines generate the source position
void GeneratePointSource();
void GeneratePointsInBeam();
void GeneratePointsInPlane();
void GeneratePointsOnSurface();
void GeneratePointsInVolume();
@@ -416,14 +420,23 @@ public:
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
@@ -443,6 +456,7 @@ public:
void SetMonoEnergy(G4double);
void SetAlpha(G4double);
void SetTemp(G4double);
void SetBeamSigmaInE(G4double);
void SetEzero(G4double);
void SetGradient(G4double);
void SetInterCept(G4double);
@@ -467,6 +481,7 @@ public:
void GenerateLinearEnergies();
void GeneratePowEnergies();
void GenerateExpEnergies();
void GenerateGaussEnergies();
void GenerateBremEnergies();
void GenerateBbodyEnergies();
void GenerateCdgEnergies();
@@ -490,6 +505,9 @@ public:
G4double GenRandPhi();
G4double GenRandEnergy();
// method to re-set the histograms
void ReSetHist(G4String);
// Set the verbosity level.
void SetVerbosity(G4int);
@@ -545,6 +563,7 @@ private:
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
@@ -556,6 +575,7 @@ private:
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
@@ -565,10 +585,12 @@ private:
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
@@ -626,6 +648,8 @@ private:
G4int verbosityLevel;
private:
G4PhysicsOrderedFreeVector ZeroPhysVector ; // for re-set only
G4DataInterpolation *SplineInt; // holds Spline stuff
@@ -636,4 +660,9 @@ private:
};
#endif
@@ -31,8 +31,8 @@
// Customer: ESA/ESTEC
//
///////////////////////////////////////////////////////////////////////////////
// $Id: G4GeneralParticleSourceMessenger.hh,v 1.3 2001/06/29 08:06:00 gcosmo Exp $
// GEANT4 tag $Name: event-V03-01-01 $
// $Id: G4GeneralParticleSourceMessenger.hh,v 1.7 2001/10/19 16:48:28 flei Exp $
// GEANT4 tag $Name: geant4-04-00 $
///////////////////////////////////////////////////////////////////////////////
//
// Class Description:
@@ -60,7 +60,7 @@
// G4String GetCurrentValue(G4UIcommand *command)
// Allows the user to retrieve the current values of parameters.
// Not implemented yet.
//
///////////////////////////////////////////////////////////////////////////////
//
// CHANGE HISTORY
@@ -125,6 +125,9 @@ private: //commands
G4UIcmdWithADoubleAndUnit *halfzCmd;
G4UIcmdWithADoubleAndUnit *radiusCmd;
G4UIcmdWithADoubleAndUnit *radius0Cmd;
G4UIcmdWithADoubleAndUnit *possigmarCmd;
G4UIcmdWithADoubleAndUnit *possigmaxCmd;
G4UIcmdWithADoubleAndUnit *possigmayCmd;
G4UIcmdWithADoubleAndUnit *paralpCmd;
G4UIcmdWithADoubleAndUnit *partheCmd;
G4UIcmdWithADoubleAndUnit *parphiCmd;
@@ -137,12 +140,17 @@ private: //commands
G4UIcmdWithADoubleAndUnit *maxthetaCmd;
G4UIcmdWithADoubleAndUnit *minphiCmd;
G4UIcmdWithADoubleAndUnit *maxphiCmd;
G4UIcmdWithADoubleAndUnit *angsigmarCmd;
G4UIcmdWithADoubleAndUnit *angsigmaxCmd;
G4UIcmdWithADoubleAndUnit *angsigmayCmd;
G4UIcmdWithABool *useuserangaxisCmd;
G4UIcmdWithABool *surfnormCmd;
G4UIcmdWithAString *energytypeCmd;
G4UIcmdWithADoubleAndUnit *eminCmd;
G4UIcmdWithADoubleAndUnit *emaxCmd;
G4UIcmdWithADoubleAndUnit *monoenergyCmd;
G4UIcmdWithADoubleAndUnit *engsigmaCmd;
G4UIcmdWithADouble *alphaCmd;
G4UIcmdWithADouble *tempCmd;
G4UIcmdWithADouble *ezeroCmd;
@@ -156,8 +164,12 @@ private: //commands
G4UIcmdWithAString *histnameCmd;
G4UIcmdWithAString *arbintCmd;
G4UIcmdWithAString *resethistCmd;
G4UIcmdWithAnInteger *verbosityCmd;
// below are commands from G4ParticleGun
G4UIcommand *ionCmd;
G4UIcmdWithAString *particleCmd;
@@ -165,6 +177,12 @@ private: //commands
G4UIcmdWith3Vector *polCmd;
G4UIcmdWithAnInteger *numberCmd;
G4UIcmdWith3VectorAndUnit *positionCmd;
G4UIcmdWith3Vector *directionCmd;
G4UIcmdWithADoubleAndUnit *energyCmd;
G4UIcmdWithoutParameter *listCmd;
private: // for ion shooting
G4bool fShootIon;
G4int fAtomicNumber;
@@ -175,3 +193,7 @@ private: //commands
};
#endif
+2 -2
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4HEPEvtInterface.hh,v 1.5.2.1 2001/06/28 19:07:53 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4HEPEvtInterface.hh,v 1.6 2001/07/11 09:58:48 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
#ifndef G4HEPEvtInterface_h
+4 -4
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4HEPEvtParticle.hh,v 1.3.4.1 2001/06/28 19:07:53 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4HEPEvtParticle.hh,v 1.5 2001/07/13 15:01:45 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
@@ -51,8 +51,8 @@ class G4HEPEvtParticle
~G4HEPEvtParticle();
const G4HEPEvtParticle & operator=(const G4HEPEvtParticle &right);
int operator==(const G4HEPEvtParticle &right) const;
int operator!=(const G4HEPEvtParticle &right) const;
G4int operator==(const G4HEPEvtParticle &right) const;
G4int operator!=(const G4HEPEvtParticle &right) const;
private:
G4PrimaryParticle * theParticle;
+4 -14
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4ParticleGun.hh,v 1.4.4.1 2001/06/28 19:07:53 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4ParticleGun.hh,v 1.7 2001/11/20 23:21:41 asaim Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
#ifndef G4ParticleGun_h
@@ -73,8 +73,8 @@ class G4ParticleGun:public G4VPrimaryGenerator
G4ParticleGun(const G4ParticleGun &right);
const G4ParticleGun & operator=(const G4ParticleGun &right);
int operator==(const G4ParticleGun &right) const;
int operator!=(const G4ParticleGun &right) const;
G4int operator==(const G4ParticleGun &right) const;
G4int operator!=(const G4ParticleGun &right) const;
public: // with description
virtual void GeneratePrimaryVertex(G4Event* evt);
@@ -92,10 +92,6 @@ class G4ParticleGun:public G4VPrimaryGenerator
{ particle_momentum_direction = aMomentumDirection.unit(); }
inline void SetParticleEnergy(G4double aKineticEnergy)
{ particle_energy = aKineticEnergy; }
inline void SetParticlePosition(G4ThreeVector aPosition)
{ particle_position = aPosition; }
inline void SetParticleTime(G4double aTime)
{ particle_time = aTime; }
inline void SetParticleCharge(G4double aCharge)
{ particle_charge = aCharge; }
inline void SetParticlePolarization(G4ThreeVector aVal)
@@ -112,10 +108,6 @@ class G4ParticleGun:public G4VPrimaryGenerator
{ return particle_energy; }
inline G4double GetParticleCharge()
{ return particle_charge; }
inline G4ThreeVector GetParticlePosition()
{ return particle_position; }
inline G4double GetParticleTime()
{ return particle_time; }
inline G4ThreeVector GetParticlePolarization()
{ return particle_polarization; }
inline G4int GetNumberOfParticles()
@@ -129,8 +121,6 @@ class G4ParticleGun:public G4VPrimaryGenerator
G4ParticleMomentum particle_momentum_direction;
G4double particle_energy;
G4double particle_charge;
G4ThreeVector particle_position;
G4double particle_time;
G4ThreeVector particle_polarization;
private:
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4ParticleGunMessenger.hh,v 1.5.4.1 2001/06/28 19:07:53 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4ParticleGunMessenger.hh,v 1.6 2001/07/11 09:58:48 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
+6 -6
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4PrimaryParticle.hh,v 1.8.2.1 2001/06/28 19:07:53 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4PrimaryParticle.hh,v 1.10 2001/07/13 15:01:46 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
@@ -76,8 +76,8 @@ class G4PrimaryParticle
~G4PrimaryParticle();
const G4PrimaryParticle & operator=(const G4PrimaryParticle &right);
int operator==(const G4PrimaryParticle &right) const;
int operator!=(const G4PrimaryParticle &right) const;
G4int operator==(const G4PrimaryParticle &right) const;
G4int operator!=(const G4PrimaryParticle &right) const;
public: // with description
void Print() const;
@@ -156,14 +156,14 @@ class G4PrimaryParticle
}
inline void SetNext(G4PrimaryParticle * np)
{
if(nextParticle == NULL)
if(nextParticle == 0)
{ nextParticle = np; }
else
{ nextParticle->SetNext(np); }
}
inline void SetDaughter(G4PrimaryParticle * np)
{
if(daughterParticle == NULL)
if(daughterParticle == 0)
{ daughterParticle = np; }
else
{ daughterParticle->SetNext(np); }
+4 -3
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4PrimaryTransformer.hh,v 1.4.4.1 2001/06/28 19:07:53 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4PrimaryTransformer.hh,v 1.6 2001/07/18 01:25:44 asaim Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
#ifndef G4PromaryTransformer_h
@@ -47,12 +47,13 @@ class G4PrimaryTransformer
G4PrimaryTransformer();
~G4PrimaryTransformer();
G4TrackVector* GimmePrimaries(G4Event* anEvent);
G4TrackVector* GimmePrimaries(G4Event* anEvent, G4int trackIDCounter=0);
private:
G4TrackVector TV;
G4ParticleTable* particleTable;
G4int verboseLevel;
G4int trackID;
public:
inline void SetVerboseLevel(G4int vl)
+9 -9
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4PrimaryVertex.hh,v 1.5.4.1 2001/06/28 19:07:53 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4PrimaryVertex.hh,v 1.7 2001/07/13 15:01:46 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
@@ -54,8 +54,8 @@ class G4PrimaryVertex
~G4PrimaryVertex();
const G4PrimaryVertex & operator=(const G4PrimaryVertex &right);
int operator==(const G4PrimaryVertex &right) const;
int operator!=(const G4PrimaryVertex &right) const;
G4int operator==(const G4PrimaryVertex &right) const;
G4int operator!=(const G4PrimaryVertex &right) const;
void Print() const;
@@ -89,7 +89,7 @@ class G4PrimaryVertex
{ return numberOfParticle; }
inline void SetPrimary(G4PrimaryParticle * pp)
{
if(theParticle == NULL)
if(theParticle == 0)
{
theParticle = pp;
theTail = pp;
@@ -108,19 +108,19 @@ class G4PrimaryVertex
else if( i > 0 && i < numberOfParticle )
{
G4PrimaryParticle* particle = theParticle;
for( int j=0; j<i; j++ )
for( G4int j=0; j<i; j++ )
{
if( particle == NULL ) return NULL;
if( particle == 0 ) return 0;
particle = particle->GetNext();
}
return particle;
}
else
{ return NULL; }
{ return 0; }
}
inline void SetNext(G4PrimaryVertex* nv)
{
if(nextVertex == NULL)
if(nextVertex == 0)
{ nextVertex = nv; }
else
{ nextVertex->SetNext(nv); }
+43 -14
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4StackManager.hh,v 1.5.4.1 2001/06/28 19:07:54 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4StackManager.hh,v 1.8 2001/07/19 00:14:16 asaim Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
@@ -66,11 +66,11 @@ class G4StackManager
private:
const G4StackManager & operator=
(const G4StackManager &right);
int operator==(const G4StackManager &right) const;
int operator!=(const G4StackManager &right) const;
G4int operator==(const G4StackManager &right) const;
G4int operator!=(const G4StackManager &right) const;
public:
G4int PushOneTrack(G4Track *newTrack, G4VTrajectory *newTrajectory = NULL);
G4int PushOneTrack(G4Track *newTrack, G4VTrajectory *newTrajectory = 0);
G4Track * PopNextTrack(G4VTrajectory**newTrajectory);
G4int PrepareNewEvent();
@@ -84,37 +84,66 @@ class G4StackManager
// stack are send to the urgent stack and then the user's NewStage()
// method is invoked.
void SetNumberOfAdditionalWaitingStacks(G4int iAdd);
// Set the number of additional (optional) waiting stacks.
// This method must be invoked at PreInit, Init or Idle states.
// Once the user set the number of additional waiting stacks,
// he/she can use the corresponding ENUM in G4ClassificationOfNewTrack.
// The user should invoke G4RunManager::SetNumberOfAdditionalWaitingStacks
// method, which invokes this method.
void TransferStackedTracks(G4ClassificationOfNewTrack origin, G4ClassificationOfNewTrack destination);
// Transfter stacked track from the origin stack to the destination stack.
// The destination stack needs not be empty.
// If the destination is fKill, tracks are deleted.
// If the origin is fKill, nothing happen.
private:
G4UserStackingAction * userStackingAction;
int verboseLevel;
G4int verboseLevel;
G4TrackStack * urgentStack;
G4TrackStack * waitingStack;
G4TrackStack * postponeStack;
G4StackingMessenger* theMessenger;
G4std::vector<G4TrackStack*> additionalWaitingStacks;
G4int numberOfAdditionalWaitingStacks;
public:
inline void clear()
{
ClearUrgentStack();
ClearWaitingStack();
for(int i=1;i<=numberOfAdditionalWaitingStacks;i++) {ClearWaitingStack(i);}
}
inline void ClearUrgentStack()
{ urgentStack->clear(); }
inline void ClearWaitingStack()
{ waitingStack->clear(); }
inline void ClearWaitingStack(int i=0)
{
if(i==0) {
waitingStack->clear();
} else {
if(i<=numberOfAdditionalWaitingStacks) additionalWaitingStacks[i-1]->clear();
}
}
inline void ClearPostponeStack()
{ postponeStack->clear(); }
inline G4int GetNTotalTrack() const
{ return urgentStack->GetNTrack()
+ waitingStack->GetNTrack()
+ postponeStack->GetNTrack(); }
{ int n = urgentStack->GetNTrack() + waitingStack->GetNTrack() + postponeStack->GetNTrack();
for(int i=1;i<=numberOfAdditionalWaitingStacks;i++) {n += additionalWaitingStacks[i-1]->GetNTrack();}
return n;
}
inline G4int GetNUrgentTrack() const
{ return urgentStack->GetNTrack(); }
inline G4int GetNWaitingTrack() const
{ return waitingStack->GetNTrack(); }
inline G4int GetNWaitingTrack(int i=0) const
{ if(i==0) { return waitingStack->GetNTrack(); }
else {
if(i<=numberOfAdditionalWaitingStacks) { return additionalWaitingStacks[i-1]->GetNTrack();}
}
return 0;
}
inline G4int GetNPostponedTrack() const
{ return postponeStack->GetNTrack(); }
inline void SetVerboseLevel( int const value )
inline void SetVerboseLevel( G4int const value )
{ verboseLevel = value; }
inline void SetUserStackingAction(G4UserStackingAction* value)
{
+4 -4
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4StackedTrack.hh,v 1.4.4.1 2001/06/28 19:07:54 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4StackedTrack.hh,v 1.6 2001/07/13 15:01:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// Last Modification : 02/Feb/96 M.Asai
@@ -54,8 +54,8 @@ class G4StackedTrack
~G4StackedTrack();
const G4StackedTrack & operator=(const G4StackedTrack &right);
int operator==(const G4StackedTrack &right) const;
int operator!=(const G4StackedTrack &right) const;
G4int operator==(const G4StackedTrack &right) const;
G4int operator!=(const G4StackedTrack &right) const;
private:
G4double priorityWeight;
+2 -2
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4StackingMessenger.hh,v 1.3.4.1 2001/06/28 19:07:54 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4StackingMessenger.hh,v 1.4 2001/07/11 09:58:49 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
#ifndef G4StackingMessenger_h
+4 -4
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4TrackStack.hh,v 1.3.4.1 2001/06/28 19:07:54 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4TrackStack.hh,v 1.5 2001/07/13 15:01:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// Last Modification : 09/Dec/96 M.Asai
@@ -50,8 +50,8 @@ class G4TrackStack
private:
const G4TrackStack & operator=
(const G4TrackStack &right);
int operator==(const G4TrackStack &right) const;
int operator!=(const G4TrackStack &right) const;
G4int operator==(const G4TrackStack &right) const;
G4int operator!=(const G4TrackStack &right) const;
public:
void PushToStack(G4StackedTrack * aStackedTrack);
+10 -16
View File
@@ -21,26 +21,23 @@
// ********************************************************************
//
//
// $Id: G4TrajectoryContainer.hh,v 1.6.2.1 2001/06/28 19:07:54 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4TrajectoryContainer.hh,v 1.8 2001/07/13 15:01:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// G4TrajectoryContainer
// G4TrajectoryContainer
//
// Class description:
//
// This is a container of G4VTrajectory objects and the object of this
// container will be associated to G4Event object.
//
// ********************************************************************
#ifndef G4TrajectoryContainer_h
#define G4TrajectoryContainer_h 1
#include "G4VTrajectory.hh"
// G4RWTPtrOrderedVector
//#include "g4rw/tpordvec.h"
// class description:
//
// This is a container of G4VTrajectory objects and the object of this
// container will be associated to G4Event object.
//typedef G4RWTPtrOrderedVector<G4VTrajectory> G4TrajectoryContainer;
class G4TrajectoryContainer : public G4std::vector<G4VTrajectory*>
{
@@ -53,11 +50,8 @@ class G4TrajectoryContainer : public G4std::vector<G4VTrajectory*>
inline G4bool insert(G4VTrajectory* p) { push_back(p); return true; }
inline void clearAndDestroy()
{
for(int i=0;i<size();i++)
{ delete (*this)[i]; }
for(size_t i=0;i<size();i++) delete (*this)[i];
clear();
}
};
#endif
+2 -2
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4UserEventAction.hh,v 1.4.4.1 2001/06/28 19:07:54 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4UserEventAction.hh,v 1.5 2001/07/11 09:58:50 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
//
+2 -2
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4UserStackingAction.hh,v 1.4.4.1 2001/06/28 19:07:54 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4UserStackingAction.hh,v 1.5 2001/07/11 09:58:50 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
#ifndef G4UserStackingAction_h
+19 -2
View File
@@ -21,13 +21,15 @@
// ********************************************************************
//
//
// $Id: G4VPrimaryGenerator.hh,v 1.3.4.1 2001/06/28 19:07:54 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4VPrimaryGenerator.hh,v 1.6 2001/11/21 13:48:40 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
#ifndef G4VPrimaryGenerator_h
#define G4VPrimaryGenerator_h 1
#include "G4ThreeVector.hh"
class G4Event;
// class description:
@@ -45,6 +47,21 @@ class G4VPrimaryGenerator
virtual ~G4VPrimaryGenerator();
virtual void GeneratePrimaryVertex(G4Event* evt) = 0;
protected:
G4ThreeVector particle_position;
G4double particle_time;
public:
G4ThreeVector GetParticlePosition()
{ return particle_position; }
G4double GetParticleTime()
{ return particle_time; }
void SetParticlePosition(G4ThreeVector aPosition)
{ particle_position = aPosition; }
void SetParticleTime(G4double aTime)
{ particle_time = aTime; }
};
#endif
+2 -2
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: eventgendefs.hh,v 1.2.4.1 2001/06/28 19:07:55 gunter Exp $
// GEANT4 tag $Name: $
// $Id: eventgendefs.hh,v 1.3 2001/07/11 09:58:50 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
#ifndef EventGenerator_DEBUG
#define EventGenerator_DEBUG
+2 -2
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: evmandefs.hh,v 1.2.4.1 2001/06/28 19:07:55 gunter Exp $
// GEANT4 tag $Name: $
// $Id: evmandefs.hh,v 1.3 2001/07/11 09:58:50 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
///#define G4EVENTMANAGER_DEBUG 1
+2 -2
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: trajectoryControl.hh,v 1.2.4.1 2001/06/28 19:07:55 gunter Exp $
// GEANT4 tag $Name: $
// $Id: trajectoryControl.hh,v 1.3 2001/07/11 09:58:51 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
////#define G4_STORE_TRAJECTORY 1
+2 -2
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4EvManMessenger.cc,v 1.2.4.1 2001/06/28 19:07:56 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4EvManMessenger.cc,v 1.3 2001/07/11 09:58:52 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
// --------------------------------------------------------------------
+11 -11
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4Event.cc,v 1.2.4.1 2001/06/28 19:07:56 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4Event.cc,v 1.4 2001/07/13 15:01:52 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
// G4Event
@@ -39,14 +39,14 @@ G4Allocator<G4Event> anEventAllocator;
G4Event::G4Event()
:eventID(0),
thePrimaryVertex(NULL),numberOfPrimaryVertex(0),
DC(NULL),HC(NULL),trajectoryContainer(NULL)
thePrimaryVertex(0),numberOfPrimaryVertex(0),
HC(0),DC(0),trajectoryContainer(0)
{;}
G4Event::G4Event(G4int evID)
:eventID(evID),
thePrimaryVertex(NULL),numberOfPrimaryVertex(0),
DC(NULL),HC(NULL),trajectoryContainer(NULL)
thePrimaryVertex(0),numberOfPrimaryVertex(0),
HC(0),DC(0),trajectoryContainer(0)
{;}
G4Event::~G4Event()
@@ -61,12 +61,12 @@ G4Event::~G4Event()
}
}
int G4Event::operator==(const G4Event &right) const
G4int G4Event::operator==(const G4Event &right) const
{
return ( eventID == right.eventID );
}
int G4Event::operator!=(const G4Event &right) const
G4int G4Event::operator!=(const G4Event &right) const
{
return ( eventID != right.eventID );
}
@@ -84,14 +84,14 @@ void G4Event::Draw() const
if(trajectoryContainer)
{
G4int n_traj = trajectoryContainer->entries();
for(int i=0;i<n_traj;i++)
for(G4int i=0;i<n_traj;i++)
{ (*trajectoryContainer)[i]->DrawTrajectory(); }
}
if(HC)
{
G4int n_HC = HC->GetCapacity();
for(int j=0;j<n_HC;j++)
for(G4int j=0;j<n_HC;j++)
{
G4VHitsCollection * VHC = HC->GetHC(j);
if(VHC) VHC->DrawAllHits();
@@ -101,7 +101,7 @@ void G4Event::Draw() const
if(DC)
{
G4int n_DC = DC->GetCapacity();
for(int j=0;j<n_DC;j++)
for(G4int j=0;j<n_DC;j++)
{
G4VDigiCollection * VDC = DC->GetDC(j);
if(VDC) VDC->DrawAllDigi();
+15 -14
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4EventManager.cc,v 1.6.2.1 2001/06/28 19:07:56 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4EventManager.cc,v 1.11 2001/08/28 05:35:00 asaim Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
//
@@ -40,8 +40,8 @@ G4EventManager* G4EventManager::GetEventManager()
{ return fpEventManager; }
G4EventManager::G4EventManager()
:verboseLevel(0),trajectoryContainer(NULL),
tracking(false),currentEvent(NULL)
:currentEvent(0),trajectoryContainer(0),
verboseLevel(0),tracking(false)
{
if(fpEventManager)
{
@@ -82,8 +82,8 @@ G4EventManager::~G4EventManager()
/*
const G4EventManager & G4EventManager::operator=(const G4EventManager &right)
{ }
int G4EventManager::operator==(const G4EventManager &right) const { }
int G4EventManager::operator!=(const G4EventManager &right) const { }
G4int G4EventManager::operator==(const G4EventManager &right) const { }
G4int G4EventManager::operator!=(const G4EventManager &right) const { }
*/
@@ -105,7 +105,7 @@ void G4EventManager::ProcessOneEvent(G4Event* anEvent)
trackIDCounter = trackContainer->PrepareNewEvent();
#ifdef G4_STORE_TRAJECTORY
trajectoryContainer = NULL;
trajectoryContainer = 0;
#endif
sdManager = G4SDManager::GetSDMpointerIfExist();
@@ -122,7 +122,7 @@ void G4EventManager::ProcessOneEvent(G4Event* anEvent)
}
#endif
StackTracks( transformer->GimmePrimaries( currentEvent ) );
StackTracks( transformer->GimmePrimaries( currentEvent, trackIDCounter ),true );
#ifdef G4VERBOSE
if ( verboseLevel > 0 )
@@ -134,7 +134,7 @@ void G4EventManager::ProcessOneEvent(G4Event* anEvent)
#endif
G4VTrajectory* previousTrajectory;
while( ( track = trackContainer->PopNextTrack(&previousTrajectory) ) != NULL )
while( ( track = trackContainer->PopNextTrack(&previousTrajectory) ) != 0 )
{
#ifdef G4VERBOSE
@@ -160,8 +160,9 @@ void G4EventManager::ProcessOneEvent(G4Event* anEvent)
}
#endif
G4VTrajectory * aTrajectory = 0;
#ifdef G4_STORE_TRAJECTORY
G4VTrajectory * aTrajectory = trackManager->GimmeTrajectory();
aTrajectory = trackManager->GimmeTrajectory();
if(previousTrajectory)
{
@@ -203,7 +204,7 @@ void G4EventManager::ProcessOneEvent(G4Event* anEvent)
//if( secondaries ) secondaries->clearAndDestroy();
if( secondaries )
{
for(G4int i=0;i<secondaries->size();i++)
for(size_t i=0;i<secondaries->size();i++)
{ delete (*secondaries)[i]; }
secondaries->clear();
}
@@ -228,11 +229,11 @@ void G4EventManager::ProcessOneEvent(G4Event* anEvent)
#endif
if(userEventAction) userEventAction->EndOfEventAction(currentEvent);
currentEvent = NULL;
currentEvent = 0;
}
void G4EventManager::StackTracks(G4TrackVector *trackVector)
void G4EventManager::StackTracks(G4TrackVector *trackVector,G4bool IDhasAlreadySet)
{
G4Track * newTrack;
@@ -245,7 +246,7 @@ void G4EventManager::StackTracks(G4TrackVector *trackVector)
{
newTrack = (*trackVector)[ i ];
trackIDCounter++;
newTrack->SetTrackID( trackIDCounter );
if(!IDhasAlreadySet) newTrack->SetTrackID( trackIDCounter );
trackContainer->PushOneTrack( newTrack );
#ifdef G4VERBOSE
if ( verboseLevel > 1 )
+430 -68
View File
@@ -30,7 +30,7 @@
// Organisation: University of Southampton / DERA
// Customer: ESA/ESTEC
//
// Documentation available at http://www.space.dera.gov.uk/space_env/gspm.html
// Documentation avaialable at http://www.space.dera.gov.uk/space_env/gspm.html
// These include:
// User Requirement Document (URD)
// Software Specification Documents (SSD)
@@ -38,12 +38,16 @@
// Technical Note (TN) on the physics and algorithms
//
///////////////////////////////////////////////////////////////////////////////
// $Id: G4GeneralParticleSource.cc,v 1.9 2001/06/29 08:06:03 gcosmo Exp $
// GEANT4 tag $Name: event-V03-01-01 $
// $Id: G4GeneralParticleSource.cc,v 1.14 2001/10/19 16:48:28 flei Exp $
// GEANT4 tag $Name: geant4-04-00 $
///////////////////////////////////////////////////////////////////////////////
//
// CHANGE HISTORY
// --------------
// Further changes is recorded in the CVS HIstory file
//
// 9-May-2001 F. Lei
// added all the g4pariclegun commands
//
// 26-01-2001, F. Lei
// replace:
@@ -51,10 +55,10 @@
//
// with:
// if (posthe != 0. && posthe != pi)
// { posphi = acos(tx/sin(posthe)); }
// posphi = acos(tx/sin(posthe));
// else
// { posphi = 0.0;}
// endif
// posphi = 0.0;
//
//
// 10-Nov-2000, F. Lei
// some bug fixing:
@@ -96,8 +100,8 @@ G4GeneralParticleSource::G4GeneralParticleSource()
NumberOfParticlesToBeGenerated = 1;
particle_definition = NULL;
G4ThreeVector zero;
particle_momentum_direction = (G4ParticleMomentum)zero;
particle_energy = 0.0;
particle_momentum_direction = G4ParticleMomentum(1,0,0);
particle_energy = 1.0*MeV;
particle_position = zero;
particle_time = 0.0;
particle_polarization = zero;
@@ -110,10 +114,13 @@ G4GeneralParticleSource::G4GeneralParticleSource()
halfz = 0.;
Radius = 0.;
Radius0 = 0.;
SR = 0.;
SX = 0.;
SY = 0.;
ParAlpha = 0.;
ParTheta = 0.;
ParPhi = 0.;
CentreCoords = (0.,0.,0.);
CentreCoords = G4ThreeVector(0., 0., 0.);
Rotx = HepXHat;
Roty = HepYHat;
Rotz = HepZHat;
@@ -122,18 +129,19 @@ G4GeneralParticleSource::G4GeneralParticleSource()
SideRefVec1 = HepXHat; // x-axis
SideRefVec2 = HepYHat; // y-axis
SideRefVec3 = HepZHat; // z-axis
UserWRTSurface = false; // Any user-defined distribution is wrt co-ordinate
// axes.
// Angular distribution variables.
AngDistType = "iso";
AngRef1 = (1.,0.,0.);
AngRef2 = (0.,1.,0.);
AngRef3 = (0.,0.,1.);
AngDistType = "planar";
AngRef1 = HepXHat;
AngRef2 = HepYHat;
AngRef3 = HepZHat;
MinTheta = 0.;
MaxTheta = pi;
MinPhi = 0.;
MaxPhi = twopi;
DR = 0.;
DX = 0.;
DY = 0.;
UserDistType = "NULL";
IPDFThetaExist = false;
IPDFPhiExist = false;
@@ -145,12 +153,15 @@ G4GeneralParticleSource::G4GeneralParticleSource()
Emax = 0.;
alpha = 0.;
Ezero = 0.;
SE = 0.;
Temp = 0.;
grad = 0.;
cept = 0.;
EnergySpec = true; // true - energy spectra, false - momentum spectra
DiffSpec = true; // true - differential spec, false integral spec
IntType = "NULL"; // Interpolation type
UserWRTSurface = false; // Any user-defined distribution is wrt co-ordinate
UserAngRef = false; // angular distribution is to mother or surface-normal co-or.
IPDFEnergyExist = false;
IPDFArbExist = false;
@@ -247,6 +258,21 @@ void G4GeneralParticleSource::SetRadius0(G4double rad)
Radius0 = rad;
}
void G4GeneralParticleSource::SetBeamSigmaInR(G4double r)
{
SR = r;
}
void G4GeneralParticleSource::SetBeamSigmaInX(G4double r)
{
SX = r;
}
void G4GeneralParticleSource::SetBeamSigmaInY(G4double r)
{
SY = r;
}
void G4GeneralParticleSource::SetParAlpha(G4double paralp)
{
ParAlpha = paralp;
@@ -291,7 +317,7 @@ void G4GeneralParticleSource::ConfineSourceToVolume(G4String Vname)
G4bool found = false;
if(verbosityLevel == 2)
G4cout << PVStore->size() << G4endl;
while (!found && i<PVStore->size()) {
while (!found && i<G4int(PVStore->size())) {
tempPV = (*PVStore)[i];
found = tempPV->GetName() == theRequiredVolumeName;
if(verbosityLevel == 2)
@@ -326,13 +352,60 @@ void G4GeneralParticleSource::GeneratePointSource()
G4cout << "Error SourcePosType is not set to Point" << G4endl;
}
void G4GeneralParticleSource::GeneratePointsInBeam()
{
G4double x, y, z, r, phi;
G4ThreeVector RandPos;
G4double tempx, tempy, tempz;
z = 0.;
// Private Method to create points in a plane
if(Shape == "Circle")
{
r = G4RandGauss::shoot(0.0,SR) ;
phi = twopi * G4UniformRand();
x = r*cos(phi) ;
y = r*sin(phi) ;
}
else
{
// all other cases default to Rectangle case
x = G4RandGauss::shoot(0.0,SX);
y = G4RandGauss::shoot(0.0,SY);
}
// Apply Rotation Matrix
// x * Rotx, y * Roty and z * Rotz
if(verbosityLevel == 2)
{
G4cout << "Raw position " << x << "," << y << "," << z << G4endl;
}
tempx = (x * Rotx.x()) + (y * Roty.x()) + (z * Rotz.x());
tempy = (x * Rotx.y()) + (y * Roty.y()) + (z * Rotz.y());
tempz = (x * Rotx.z()) + (y * Roty.z()) + (z * Rotz.z());
RandPos.setX(tempx);
RandPos.setY(tempy);
RandPos.setZ(tempz);
// Translate
particle_position = CentreCoords + RandPos;
if(verbosityLevel >= 1)
{
if(verbosityLevel == 2)
{
G4cout << "Rotated Position " << RandPos << G4endl;
}
G4cout << "Rotated and Translated position " << particle_position << G4endl;
}
}
void G4GeneralParticleSource::GeneratePointsInPlane()
{
G4double x, y, z;
G4double expression;
G4ThreeVector RandPos;
G4double tempx, tempy, tempz;
z = 0.;
x = y = z = 0.;
if(SourcePosType != "Plane" && verbosityLevel >= 1)
G4cout << "Error: SourcePosType is not Plane" << G4endl;
@@ -448,15 +521,16 @@ void G4GeneralParticleSource::GeneratePointsOnSurface()
//Private method to create points on a surface
G4double theta, phi;
G4double x, y, z;
x = y = z = 0.;
G4ThreeVector RandPos;
G4double tempx, tempy, tempz;
// G4double tempx, tempy, tempz;
if(SourcePosType != "Surface" && verbosityLevel >= 1)
G4cout << "Error SourcePosType not Surface" << G4endl;
if(Shape == "Sphere")
{
G4double tantheta, tanphi;
G4double tantheta;
theta = GenRandTheta();
phi = GenRandPhi();
@@ -483,7 +557,7 @@ void G4GeneralParticleSource::GeneratePointsOnSurface()
}
else if(Shape == "Ellipsoid")
{
G4double testrand, theta, phi, minphi, maxphi, middlephi;
G4double theta, phi, minphi, maxphi, middlephi;
G4double answer, constant;
constant = pi/(halfx*halfx) + pi/(halfy*halfy) +
@@ -854,7 +928,7 @@ void G4GeneralParticleSource::GeneratePointsInVolume()
G4ThreeVector RandPos;
G4double tempx, tempy, tempz;
G4double x, y, z;
x = y = z = 0.;
if(SourcePosType != "Volume" && verbosityLevel >= 1)
G4cout << "Error SourcePosType not Volume" << G4endl;
//Private method to create points in a volume
@@ -990,19 +1064,27 @@ G4bool G4GeneralParticleSource::IsSourceConfined()
void G4GeneralParticleSource::SetAngDistType(G4String atype)
{
if(atype != "iso" && atype != "cos" && atype != "user")
G4cout << "Error, distribution must be iso, cos or user" << G4endl;
if(atype != "iso" && atype != "cos" && atype != "user" && atype != "planar"
&& atype != "beam1d" && atype != "beam2d")
G4cout << "Error, distribution must be iso, cos, planar, beam1d, beam2d or user" << G4endl;
else
AngDistType = atype;
if (AngDistType == "cos") MaxTheta = pi/2. ;
if (AngDistType == "user") {
UDefThetaH = IPDFThetaH = ZeroPhysVector ;
IPDFThetaExist = false ;
UDefPhiH = IPDFPhiH = ZeroPhysVector ;
IPDFPhiExist = false ;
}
}
void G4GeneralParticleSource::DefineAngRefAxes(G4String refname, G4ThreeVector ref)
{
if(refname == "angref1")
AngRef1 = ref; // x'
AngRef1 = ref.unit(); // x'
else if(refname == "angref2")
AngRef2 = ref; // vector in x'y' plane
AngRef2 = ref.unit(); // vector in x'y' plane
// User defines x' (AngRef1) and a vector in the x'y'
// plane (AngRef2). Then, AngRef1 x AngRef2 = AngRef3
@@ -1011,6 +1093,7 @@ void G4GeneralParticleSource::DefineAngRefAxes(G4String refname, G4ThreeVector r
AngRef3 = AngRef1.cross(AngRef2); // z'
AngRef2 = AngRef3.cross(AngRef1); // y'
UserAngRef = true ;
if(verbosityLevel == 2)
{
G4cout << "Angular distribution rotation axes " << AngRef1 << " " << AngRef2 << " " << AngRef3 << G4endl;
@@ -1037,6 +1120,21 @@ void G4GeneralParticleSource::SetMaxPhi(G4double maxp)
MaxPhi = maxp;
}
void G4GeneralParticleSource::SetBeamSigmaInAngR(G4double r)
{
DR = r;
}
void G4GeneralParticleSource::SetBeamSigmaInAngX(G4double r)
{
DX = r;
}
void G4GeneralParticleSource::SetBeamSigmaInAngY(G4double r)
{
DY = r;
}
void G4GeneralParticleSource::UserDefAngTheta(G4ThreeVector input)
{
if(UserDistType == "NULL") UserDistType = "theta";
@@ -1070,12 +1168,67 @@ void G4GeneralParticleSource::SetUserWRTSurface(G4bool wrtSurf)
UserWRTSurface = wrtSurf;
}
void G4GeneralParticleSource::SetUseUserAngAxis(G4bool userang)
{
// if UserAngRef = true the angular distribution is defined wrt
// the user defined co-ordinates
UserAngRef = userang;
}
void G4GeneralParticleSource::GenerateBeamFlux()
{
// generates isotropic flux.
// No vectors are needed.
G4double theta, phi;
G4double px, py, pz;
if (AngDistType == "beam1d")
{
theta = G4RandGauss::shoot(0.0,DR);
phi = twopi * G4UniformRand();
}
else
{
px = G4RandGauss::shoot(0.0,DX);
py = G4RandGauss::shoot(0.0,DY);
theta = sqrt (px*px + py*py);
if (theta != 0.) {
phi = acos(px/theta);
if ( py < 0.) phi = -phi;
}
else
{
phi = 0.0;
}
}
px = -sin(theta) * cos(phi);
py = -sin(theta) * sin(phi);
pz = -cos(theta);
// Apply Angular Rotation Matrix
// x * AngRef1, y * AngRef2 and z * AngRef3
G4double finx, finy, finz;
finx = (px * AngRef1.x()) + (py * AngRef2.x()) + (pz * AngRef3.x());
finy = (px * AngRef1.y()) + (py * AngRef2.y()) + (pz * AngRef3.y());
finz = (px * AngRef1.z()) + (py * AngRef2.z()) + (pz * AngRef3.z());
G4double ResMag = sqrt((finx*finx) + (finy*finy) + (finz*finz));
finx = finx/ResMag;
finy = finy/ResMag;
finz = finz/ResMag;
particle_momentum_direction.setX(finx);
particle_momentum_direction.setY(finy);
particle_momentum_direction.setZ(finz);
// particle_momentum_direction now holds unit momentum vector.
if(verbosityLevel >= 1)
G4cout << "Generating beam vector: " << particle_momentum_direction << G4endl;
}
void G4GeneralParticleSource::GenerateIsotropicFlux()
{
// generates isotropic flux.
// No vectors are needed.
G4double rndm, rndm2;
G4double px, py, pz, pmag;
G4double px, py, pz;
// generate rand nos. but make sure in theta/phi limits
/* Colin's old stuff
@@ -1111,21 +1264,23 @@ void G4GeneralParticleSource::GenerateIsotropicFlux()
sinphi = sin(Phi);
cosphi = cos(Phi);
px = sintheta * cosphi;
py = sintheta * sinphi;
pz = costheta;
px = -sintheta * cosphi;
py = -sintheta * sinphi;
pz = -costheta;
// end of F.Lei implementation
px = -px;
py = -py;
pz = -pz;
// px = -px;
//py = -py;
//pz = -pz;
pmag = sqrt((px*px) + (py*py) + (pz*pz));
// pmag = sqrt((px*px) + (py*py) + (pz*pz));
px = px/pmag;
py = py/pmag;
pz = pz/pmag;
//px = px/pmag;
//py = py/pmag;
//pz = pz/pmag;
/* this implmentation is commented out by f.lei
//Need to rotate the particle_momentum_direction round such that the
//start position is at the north pole, so that all particles go into
@@ -1144,17 +1299,60 @@ void G4GeneralParticleSource::GenerateIsotropicFlux()
ty = ty/tt;
tz = tz/tt;
// G4cout << "unit position " << tx << " " << ty << " " << tz << G4endl;
posthe = acos(tz);
if (posthe != 0. && posthe != pi)
{ posphi = acos(tx/sin(posthe)); }
else
{ posphi = 0.0;}
if (tt != 0.) {
posthe = acos(tz);
}
else {
posthe = 0.;
}
if (posthe != 0. && posthe != pi){
posphi = acos(tx/sin(posthe));
}
else{
posphi = 0.0;
}
// G4cout << "Posthe and posphi " << posthe << " " << posphi << G4endl;
G4double finx, finy, finz;
finx = (px*cos(posthe)*cos(posphi)) - (py*sin(posphi)) + (pz*sin(posthe)*cos(posphi));
finy = (px*cos(posthe)*sin(posphi)) + (py*cos(posphi)) + (pz*sin(posthe)*sin(posphi));
finz = (-px*sin(posthe)) + (pz*cos(posthe));
// G4cout << "finx... " << finx << " " << finy << " " << finz << G4endl;
// G4cout << "finx... " << finx << " " << finy << " " << finz << G4endl;
*/
// New implementation
// for volume and ponit source use mother or user defined co-ordinates
// for plane and surface source user surface-normal or userdefined co-ordinates
//
G4double finx, finy, finz;
if (SourcePosType == "Point" || SourcePosType == "Volume") {
if (UserAngRef){
// Apply Rotation Matrix
// x * AngRef1, y * AngRef2 and z * AngRef3
finx = (px * AngRef1.x()) + (py * AngRef2.x()) + (pz * AngRef3.x());
finy = (px * AngRef1.y()) + (py * AngRef2.y()) + (pz * AngRef3.y());
finz = (px * AngRef1.z()) + (py * AngRef2.z()) + (pz * AngRef3.z());
} else {
finx = px;
finy = py;
finz = pz;
}
} else { // for plane and surface source
if (UserAngRef){
// Apply Rotation Matrix
// x * AngRef1, y * AngRef2 and z * AngRef3
finx = (px * AngRef1.x()) + (py * AngRef2.x()) + (pz * AngRef3.x());
finy = (px * AngRef1.y()) + (py * AngRef2.y()) + (pz * AngRef3.y());
finz = (px * AngRef1.z()) + (py * AngRef2.z()) + (pz * AngRef3.z());
} else {
finx = (px*SideRefVec1.x()) + (py*SideRefVec2.x()) + (pz*SideRefVec3.x());
finy = (px*SideRefVec1.y()) + (py*SideRefVec2.y()) + (pz*SideRefVec3.y());
finz = (px*SideRefVec1.z()) + (py*SideRefVec2.z()) + (pz*SideRefVec3.z());
}
}
G4double ResMag = sqrt((finx*finx) + (finy*finy) + (finz*finz));
finx = finx/ResMag;
finy = finy/ResMag;
finz = finz/ResMag;
particle_momentum_direction.setX(finx);
particle_momentum_direction.setY(finy);
@@ -1169,9 +1367,9 @@ void G4GeneralParticleSource::GenerateCosineLawFlux()
{
// Method to generate flux distributed with a cosine law
// such as is in TIMM.
G4double px, py, pz, pmag;
G4double px, py, pz;
G4double rndm, rndm2;
G4double resultx, resulty, resultz;
// G4double resultx, resulty, resultz;
/* Colin's old implementation which is very slow
@@ -1198,7 +1396,8 @@ void G4GeneralParticleSource::GenerateCosineLawFlux()
//
G4double sintheta, sinphi,costheta,cosphi;
rndm = GenRandTheta();
sintheta = sqrt( rndm * (sin(MaxTheta)*sin(MaxTheta) - sin(MinTheta)*sin(MinTheta) ) );
sintheta = sqrt( rndm * (sin(MaxTheta)*sin(MaxTheta) - sin(MinTheta)*sin(MinTheta) )
+sin(MinTheta)*sin(MinTheta) );
costheta = sqrt(1. -sintheta*sintheta);
rndm2 = GenRandPhi();
@@ -1206,20 +1405,21 @@ void G4GeneralParticleSource::GenerateCosineLawFlux()
sinphi = sin(Phi);
cosphi = cos(Phi);
px = sintheta * cosphi;
py = sintheta * sinphi;
pz = costheta;
px = -sintheta * cosphi;
py = -sintheta * sinphi;
pz = -costheta;
// end of F.Lei implementation
px = -px;
py = -py;
pz = -pz;
pmag = sqrt((px*px) + (py*py) + (pz*pz));
G4double pxh = px/pmag;
G4double pyh = py/pmag;
G4double pzh = pz/pmag;
// px = -px;
//py = -py;
//pz = -pz;
//pmag = sqrt((px*px) + (py*py) + (pz*pz));
//G4double pxh = px/pmag;
//G4double pyh = py/pmag;
//G4double pzh = pz/pmag;
/* commented out by F. Lei
if(verbosityLevel == 2)
{
G4cout <<"SideRefVecs " <<SideRefVec1<<SideRefVec2<<SideRefVec3<<G4endl;
@@ -1243,6 +1443,46 @@ void G4GeneralParticleSource::GenerateCosineLawFlux()
particle_momentum_direction.setY(resulty);
particle_momentum_direction.setZ(resultz);
*/
// New implementation
// for volume and ponit source use mother or user defined co-ordinates
// for plane and surface source user surface-normal or userdefined co-ordinates
//
G4double finx, finy, finz;
if (SourcePosType == "Point" || SourcePosType == "Volume") {
if (UserAngRef){
// Apply Rotation Matrix
// x * AngRef1, y * AngRef2 and z * AngRef3
finx = (px * AngRef1.x()) + (py * AngRef2.x()) + (pz * AngRef3.x());
finy = (px * AngRef1.y()) + (py * AngRef2.y()) + (pz * AngRef3.y());
finz = (px * AngRef1.z()) + (py * AngRef2.z()) + (pz * AngRef3.z());
} else {
finx = px;
finy = py;
finz = pz;
}
} else { // for plane and surface source
if (UserAngRef){
// Apply Rotation Matrix
// x * AngRef1, y * AngRef2 and z * AngRef3
finx = (px * AngRef1.x()) + (py * AngRef2.x()) + (pz * AngRef3.x());
finy = (px * AngRef1.y()) + (py * AngRef2.y()) + (pz * AngRef3.y());
finz = (px * AngRef1.z()) + (py * AngRef2.z()) + (pz * AngRef3.z());
} else {
finx = (px*SideRefVec1.x()) + (py*SideRefVec2.x()) + (pz*SideRefVec3.x());
finy = (px*SideRefVec1.y()) + (py*SideRefVec2.y()) + (pz*SideRefVec3.y());
finz = (px*SideRefVec1.z()) + (py*SideRefVec2.z()) + (pz*SideRefVec3.z());
}
}
G4double ResMag = sqrt((finx*finx) + (finy*finy) + (finz*finz));
finx = finx/ResMag;
finy = finy/ResMag;
finz = finz/ResMag;
particle_momentum_direction.setX(finx);
particle_momentum_direction.setY(finy);
particle_momentum_direction.setZ(finz);
// particle_momentum_direction now contains unit momentum vector.
if(verbosityLevel >= 1)
{
@@ -1250,6 +1490,17 @@ void G4GeneralParticleSource::GenerateCosineLawFlux()
}
}
void G4GeneralParticleSource::GeneratePlanarFlux()
{
// particle_momentum_direction now contains unit momentum vector.
// nothing need be done here as the m-directions have been set directly
// under this option
if(verbosityLevel >= 1)
{
G4cout << "Resultant Planar wave momentum vector " << particle_momentum_direction << G4endl;
}
}
void G4GeneralParticleSource::GenerateUserDefFlux()
{
G4double rndm, px, py, pz, pmag;
@@ -1290,9 +1541,26 @@ void G4GeneralParticleSource::GenerateUserDefFlux()
if(UserWRTSurface == false)
{
particle_momentum_direction.setX(px/pmag);
particle_momentum_direction.setY(py/pmag);
particle_momentum_direction.setZ(pz/pmag);
G4double finx, finy, finz;
if (UserAngRef) {
// Apply Rotation Matrix
// x * AngRef1, y * AngRef2 and z * AngRef3
finx = (px * AngRef1.x()) + (py * AngRef2.x()) + (pz * AngRef3.x());
finy = (px * AngRef1.y()) + (py * AngRef2.y()) + (pz * AngRef3.y());
finz = (px * AngRef1.z()) + (py * AngRef2.z()) + (pz * AngRef3.z());
} else { // use mother co-ordinates
finx = px;
finy = py;
finz = pz;
}
G4double ResMag = sqrt((finx*finx) + (finy*finy) + (finz*finz));
finx = finx/ResMag;
finy = finy/ResMag;
finz = finz/ResMag;
particle_momentum_direction.setX(finx);
particle_momentum_direction.setY(finy);
particle_momentum_direction.setZ(finz);
}
else if(UserWRTSurface == true)
{
@@ -1323,7 +1591,7 @@ void G4GeneralParticleSource::GenerateUserDefFlux()
particle_momentum_direction.setY(resulty);
particle_momentum_direction.setZ(resultz);
}
// particle_momentum_direction now contains unit momentum vector.
if(verbosityLevel >= 1)
{
@@ -1427,6 +1695,17 @@ G4double G4GeneralParticleSource::GenerateUserDefPhi()
void G4GeneralParticleSource::SetEnergyDisType(G4String DisType)
{
EnergyDisType = DisType;
if (EnergyDisType == "User"){
UDefEnergyH = IPDFEnergyH = ZeroPhysVector ;
IPDFEnergyExist = false ;
} else if ( EnergyDisType == "Arb"){
ArbEnergyH =IPDFArbEnergyH = ZeroPhysVector ;
IPDFArbExist = false;
} else if (EnergyDisType == "Epn"){
UDefEnergyH = IPDFEnergyH = ZeroPhysVector ;
IPDFEnergyExist = false ;
EpnEnergyH = ZeroPhysVector ;
}
}
void G4GeneralParticleSource::SetEmin(G4double emi)
@@ -1446,6 +1725,10 @@ void G4GeneralParticleSource::SetMonoEnergy(G4double menergy)
Emax = menergy;
}
void G4GeneralParticleSource::SetBeamSigmaInE(G4double e)
{
SE = e;
}
void G4GeneralParticleSource::SetAlpha(G4double alp)
{
alpha = alp;
@@ -1496,7 +1779,7 @@ void G4GeneralParticleSource::ArbEnergyHisto(G4ThreeVector input)
void G4GeneralParticleSource::EpnEnergyHisto(G4ThreeVector input)
{
G4double elo, ehi, val;
G4double ehi, val;
ehi = input.x();
val = input.y();
if(verbosityLevel == 2)
@@ -1625,7 +1908,7 @@ void G4GeneralParticleSource::ArbInterpolate(G4String IType)
if(EnergyDisType != "Arb")
G4cout << "Error: this is for arbitrary distributions" << G4endl;
IntType = IType;
G4int i=0;
// Calcuate Emin and Emax, mainly for use in debugging
G4int len = G4int(ArbEnergyH.GetVectorLength());
@@ -2099,9 +2382,16 @@ void G4GeneralParticleSource::GenerateMonoEnergetic()
particle_energy = MonoEnergy;
}
void G4GeneralParticleSource::GenerateGaussEnergies()
{
// Method to generate Gaussian particles.
particle_energy = G4RandGauss::shoot(MonoEnergy,SE);
if (particle_energy < 0) particle_energy = 0.;
}
void G4GeneralParticleSource::GenerateLinearEnergies()
{
G4double energy, rndm;
G4double rndm;
G4double emaxsq = pow(Emax,2.); //Emax squared
G4double eminsq = pow(Emin,2.); //Emin squared
G4double intersq = pow(cept,2.); //cept squared
@@ -2337,6 +2627,7 @@ void G4GeneralParticleSource::GenUserHistEnergies()
G4int ii;
G4int maxbin = G4int(UDefEnergyH.GetVectorLength());
G4double bins[256], vals[256], sum;
sum=0.;
// UDefEnergyH.DumpValues();
G4double mass = particle_definition->GetPDGMass();
// G4cout << mass << G4endl;
@@ -2631,6 +2922,56 @@ void G4GeneralParticleSource::SetEnergyBias(G4ThreeVector input)
EnergyBias = true;
}
void G4GeneralParticleSource::ReSetHist(G4String atype)
{
if (atype == "theta") {
UDefThetaH = IPDFThetaH = ZeroPhysVector ;
IPDFThetaExist = false ;}
else if (atype == "phi"){
UDefPhiH = IPDFPhiH = ZeroPhysVector ;
IPDFPhiExist = false ;}
else if (atype == "energy"){
UDefEnergyH = IPDFEnergyH = ZeroPhysVector ;
IPDFEnergyExist = false ;}
else if ( atype == "arb"){
ArbEnergyH =IPDFArbEnergyH = ZeroPhysVector ;
IPDFArbExist = false;}
else if ( atype == "epn"){
UDefEnergyH = IPDFEnergyH = ZeroPhysVector ;
IPDFEnergyExist = false ;
EpnEnergyH = ZeroPhysVector ;}
else if ( atype == "biasx") {
XBias = false ;
IPDFXBias = false;
XBiasH = IPDFXBiasH = ZeroPhysVector ;}
else if ( atype == "biasy") {
YBias = false ;
IPDFYBias = false;
YBiasH = IPDFYBiasH = ZeroPhysVector ;}
else if ( atype == "biasz") {
ZBias = false ;
IPDFZBias = false;
ZBiasH = IPDFZBiasH = ZeroPhysVector ;}
else if ( atype == "biast") {
ThetaBias = false ;
IPDFThetaBias = false;
ThetaBiasH = IPDFThetaBiasH = ZeroPhysVector ;}
else if ( atype == "biasp") {
PhiBias = false ;
IPDFPhiBias = false;
PhiBiasH = IPDFPhiBiasH = ZeroPhysVector ;}
else if ( atype == "biase") {
EnergyBias = false ;
IPDFEnergyBias = false;
EnergyBiasH = IPDFEnergyBiasH = ZeroPhysVector ;}
else {
G4cout << "Error, histtype not accepted " << G4endl;
}
}
G4double G4GeneralParticleSource::GenRandX()
{
if(verbosityLevel >= 1)
@@ -3055,6 +3396,8 @@ void G4GeneralParticleSource::GeneratePrimaryVertex(G4Event *evt)
{
if(SourcePosType == "Point")
GeneratePointSource();
else if(SourcePosType == "Beam")
GeneratePointsInBeam();
else if(SourcePosType == "Plane")
GeneratePointsInPlane();
else if(SourcePosType == "Surface")
@@ -3096,6 +3439,10 @@ void G4GeneralParticleSource::GeneratePrimaryVertex(G4Event *evt)
GenerateIsotropicFlux();
else if(AngDistType == "cos")
GenerateCosineLawFlux();
else if(AngDistType == "planar")
GeneratePlanarFlux();
else if(AngDistType == "beam1d" || AngDistType == "beam2d" )
GenerateBeamFlux();
else if(AngDistType == "user")
GenerateUserDefFlux();
else
@@ -3109,6 +3456,8 @@ void G4GeneralParticleSource::GeneratePrimaryVertex(G4Event *evt)
GeneratePowEnergies();
else if(EnergyDisType == "Exp")
GenerateExpEnergies();
else if(EnergyDisType == "Gauss")
GenerateGaussEnergies();
else if(EnergyDisType == "Brem")
GenerateBremEnergies();
else if(EnergyDisType == "Bbody")
@@ -3138,6 +3487,13 @@ void G4GeneralParticleSource::GeneratePrimaryVertex(G4Event *evt)
G4double py = pmom*particle_momentum_direction.y();
G4double pz = pmom*particle_momentum_direction.z();
if(verbosityLevel > 1){
G4cout << "Particle name: "<<particle_definition->GetParticleName() << G4endl;
G4cout << " Energy: "<<particle_energy << G4endl;
G4cout << " Position: "<<particle_position<< G4endl;
G4cout << " Direction: "<<particle_momentum_direction << G4endl;
G4cout << " NumberOfParticlesToBeGenerated: "<<NumberOfParticlesToBeGenerated << G4endl;
}
for( G4int i=0; i<NumberOfParticlesToBeGenerated; i++ )
{
G4PrimaryParticle* particle =
@@ -3150,19 +3506,25 @@ void G4GeneralParticleSource::GeneratePrimaryVertex(G4Event *evt)
vertex->SetPrimary( particle );
// Set bweight equal to the multiple of all non-zero weights
bweight = 0.;
bweight = 1.;
for(int bib=0; bib<6; bib++)
{
if(bweights[bib] > 0. && bweight == 0.)
bweight = bweight + bweights[bib];
else if(bweights[bib] > 0.)
bweight = bweight * bweights[bib];
if(bweights[bib] > 0.) bweight = bweight * bweights[bib];
}
// bweight will now contain the events final weighting.
// now pass it to the primary vertex
vertex->SetWeight(bweight);
}
evt->AddPrimaryVertex( vertex );
if(verbosityLevel > 1)
G4cout << " Primary Vetex generated !"<< G4endl;
}
@@ -21,7 +21,7 @@
// ********************************************************************
//
///////////////////////////////////////////////////////////////////////////////
//
//
// MODULE: G4GeneralParticleSourceMessenger.cc
//
// Version: 1.
@@ -31,15 +31,15 @@
// Customer: ESA/ESTEC
//
///////////////////////////////////////////////////////////////////////////////
// $Id: G4GeneralParticleSourceMessenger.cc,v 1.4 2001/06/29 08:06:04 gcosmo Exp $
// GEANT4 tag $Name: event-V03-01-01 $
///////////////////////////////////////////////////////////////////////////////
//
// CHANGE HISTORY
// --------------
//
// 9-May-2001 F. Lei
// added all the g4pariclegun commands
//
// 10-Nov-2000 F. Lei
// changed
// changed
// #include <iostream.h>
// to
// #include "g4std/fstream"
@@ -66,13 +66,13 @@
#include "G4UIcmdWithABool.hh"
#include "G4ios.hh"
//#include <iostream.h>
#include "g4std/fstream"
#include "g4std/iomanip"
#include "g4rw/ctoken.h"
#include "g4rw/rstream.h"
#include "g4std/iomanip"
#include "g4std/strstream"
#include "G4Tokenizer.hh"
#include "G4GeneralParticleSourceMessenger.hh"
#include "G4GeneralParticleSource.hh"
///////////////////////////////////////////////////////////////////////////////
@@ -86,13 +86,106 @@ G4GeneralParticleSourceMessenger::G4GeneralParticleSourceMessenger
gpsDirectory = new G4UIdirectory("/gps/");
gpsDirectory->SetGuidance("General Paricle Source control commands.");
gpsDirectory->SetGuidance(" The first 9 commands are the same as in G4ParticleGun ");
// below we reproduce commands awailable in G4Particle Gun
listCmd = new G4UIcmdWithoutParameter("/gps/List",this);
listCmd->SetGuidance("List available particles.");
listCmd->SetGuidance(" Invoke G4ParticleTable.");
particleCmd = new G4UIcmdWithAString("/gps/particle",this);
particleCmd->SetGuidance("Set particle to be generated.");
particleCmd->SetGuidance(" (geantino is default)");
particleCmd->SetGuidance(" (ion can be specified for shooting ions)");
particleCmd->SetParameterName("particleName",true);
particleCmd->SetDefaultValue("geantino");
G4String candidateList;
G4int nPtcl = particleTable->entries();
for(G4int i=0;i<nPtcl;i++)
{
candidateList += particleTable->GetParticleName(i);
candidateList += " ";
}
candidateList += "ion ";
particleCmd->SetCandidates(candidateList);
directionCmd = new G4UIcmdWith3Vector("/gps/direction",this);
directionCmd->SetGuidance("Set momentum direction.");
directionCmd->SetGuidance("Direction needs not to be a unit vector.");
directionCmd->SetParameterName("Px","Py","Pz",true,true);
directionCmd->SetRange("Px != 0 || Py != 0 || Pz != 0");
energyCmd = new G4UIcmdWithADoubleAndUnit("/gps/energy",this);
energyCmd->SetGuidance("Set kinetic energy.");
energyCmd->SetParameterName("Energy",true,true);
energyCmd->SetDefaultUnit("GeV");
//energyCmd->SetUnitCategory("Energy");
//energyCmd->SetUnitCandidates("eV keV MeV GeV TeV");
positionCmd = new G4UIcmdWith3VectorAndUnit("/gps/position",this);
positionCmd->SetGuidance("Set starting position of the particle.");
positionCmd->SetParameterName("X","Y","Z",true,true);
positionCmd->SetDefaultUnit("cm");
//positionCmd->SetUnitCategory("Length");
//positionCmd->SetUnitCandidates("microm mm cm m km");
// SR1.3
// ionCmd = new UIcmdWithNucleusAndUnit("/gps/ion",this);
//ionCmd->SetGuidance("define the primary ion (a,z,e)");
//ionCmd->SetParameterName("A","Z","E",true);
//ionCmd->SetDefaultUnit("keV");
//ionCmd->SetUnitCandidates("keV MeV");
ionCmd = new G4UIcommand("/gps/ion",this);
ionCmd->SetGuidance("Set properties of ion to be generated.");
ionCmd->SetGuidance("[usage] /gun/ion Z A Q E");
ionCmd->SetGuidance(" Z:(int) AtomicNumber");
ionCmd->SetGuidance(" A:(int) AtomicMass");
ionCmd->SetGuidance(" Q:(int) Charge of Ion (in unit of e)");
ionCmd->SetGuidance(" E:(double) Excitation energy (in keV)");
G4UIparameter* param;
param = new G4UIparameter("Z",'i',false);
param->SetDefaultValue("1");
ionCmd->SetParameter(param);
param = new G4UIparameter("A",'i',false);
param->SetDefaultValue("1");
ionCmd->SetParameter(param);
param = new G4UIparameter("Q",'i',true);
param->SetDefaultValue("0");
ionCmd->SetParameter(param);
param = new G4UIparameter("E",'d',true);
param->SetDefaultValue("0.0");
ionCmd->SetParameter(param);
timeCmd = new G4UIcmdWithADoubleAndUnit("/gps/time",this);
timeCmd->SetGuidance("Set initial time of the particle.");
timeCmd->SetParameterName("t0",true,true);
timeCmd->SetDefaultUnit("ns");
//timeCmd->SetUnitCategory("Time");
//timeCmd->SetUnitCandidates("ns ms s");
polCmd = new G4UIcmdWith3Vector("/gps/polarization",this);
polCmd->SetGuidance("Set polarization.");
polCmd->SetParameterName("Px","Py","Pz",true,true);
polCmd->SetRange("Px>=-1.&&Px<=1.&&Py>=-1.&&Py<=1.&&Pz>=-1.&&Pz<=1.");
numberCmd = new G4UIcmdWithAnInteger("/gps/number",this);
numberCmd->SetGuidance("Set number of particles to be generated.");
numberCmd->SetParameterName("N",true,true);
numberCmd->SetRange("N>0");
// now extended commands
typeCmd = new G4UIcmdWithAString("/gps/type",this);
typeCmd->SetGuidance("Sets source distribution type.");
typeCmd->SetGuidance("Either Point, Plane, Surface or Volume");
typeCmd->SetGuidance("Either Point, Beam, Plane, Surface or Volume");
typeCmd->SetParameterName("DisType",true,true);
typeCmd->SetDefaultValue("Point");
typeCmd->SetCandidates("Point Plane Surface Volume");
typeCmd->SetCandidates("Point Beam Plane Surface Volume");
shapeCmd = new G4UIcmdWithAString("/gps/shape",this);
shapeCmd->SetGuidance("Sets source shape type.");
@@ -148,6 +241,24 @@ G4GeneralParticleSourceMessenger::G4GeneralParticleSourceMessenger
radius0Cmd->SetDefaultUnit("cm");
radius0Cmd->SetUnitCandidates("micron mm cm m km");
possigmarCmd = new G4UIcmdWithADoubleAndUnit("/gps/sigmaposr",this);
possigmarCmd->SetGuidance("Set standard deviation of beam position in radial");
possigmarCmd->SetParameterName("Sigmar",true,true);
possigmarCmd->SetDefaultUnit("cm");
possigmarCmd->SetUnitCandidates("micron mm cm m km");
possigmaxCmd = new G4UIcmdWithADoubleAndUnit("/gps/sigmaposx",this);
possigmaxCmd->SetGuidance("Set standard deviation of beam position in x-dir");
possigmaxCmd->SetParameterName("Sigmax",true,true);
possigmaxCmd->SetDefaultUnit("cm");
possigmaxCmd->SetUnitCandidates("micron mm cm m km");
possigmayCmd = new G4UIcmdWithADoubleAndUnit("/gps/sigmaposy",this);
possigmayCmd->SetGuidance("Set standard deviation of beam position in y-dir");
possigmayCmd->SetParameterName("Sigmay",true,true);
possigmayCmd->SetDefaultUnit("cm");
possigmayCmd->SetUnitCandidates("micron mm cm m km");
paralpCmd = new G4UIcmdWithADoubleAndUnit("/gps/paralp",this);
paralpCmd->SetGuidance("Angle from y-axis of y' in Para");
paralpCmd->SetParameterName("paralp",true,true);
@@ -175,10 +286,10 @@ G4GeneralParticleSourceMessenger::G4GeneralParticleSourceMessenger
// Angular distribution commands
angtypeCmd = new G4UIcmdWithAString("/gps/angtype",this);
angtypeCmd->SetGuidance("Sets angular source distribution type");
angtypeCmd->SetGuidance("Possible variables are: iso, cos or user");
angtypeCmd->SetGuidance("Possible variables are: iso, cos planar beam1d beam2d or user");
angtypeCmd->SetParameterName("AngDis",true,true);
angtypeCmd->SetDefaultValue("iso");
angtypeCmd->SetCandidates("iso cos user");
angtypeCmd->SetCandidates("iso cos planar beam1d beam2d user");
angrot1Cmd = new G4UIcmdWith3Vector("/gps/angrot1",this);
angrot1Cmd->SetGuidance("Sets the x' vector for angular distribution");
@@ -217,6 +328,30 @@ G4GeneralParticleSourceMessenger::G4GeneralParticleSourceMessenger
maxphiCmd->SetDefaultUnit("rad");
maxphiCmd->SetUnitCandidates("rad deg");
angsigmarCmd = new G4UIcmdWithADoubleAndUnit("/gps/sigmaangr",this);
angsigmarCmd->SetGuidance("Set standard deviation of beam direction in radial.");
angsigmarCmd->SetParameterName("Sigmara",true,true);
angsigmarCmd->SetDefaultUnit("rad");
angsigmarCmd->SetUnitCandidates("rad deg");
angsigmaxCmd = new G4UIcmdWithADoubleAndUnit("/gps/sigmaangx",this);
angsigmaxCmd->SetGuidance("Set standard deviation of beam direction in x-direc.");
angsigmaxCmd->SetParameterName("Sigmaxa",true,true);
angsigmaxCmd->SetDefaultUnit("rad");
angsigmaxCmd->SetUnitCandidates("rad deg");
angsigmayCmd = new G4UIcmdWithADoubleAndUnit("/gps/sigmaangy",this);
angsigmayCmd->SetGuidance("Set standard deviation of beam direction in y-direc.");
angsigmayCmd->SetParameterName("Sigmaya",true,true);
angsigmayCmd->SetDefaultUnit("rad");
angsigmayCmd->SetUnitCandidates("rad deg");
useuserangaxisCmd = new G4UIcmdWithABool("/gps/useuserangaxis",this);
useuserangaxisCmd->SetGuidance("true for using user defined angular co-ordinates");
useuserangaxisCmd->SetGuidance("Default is false");
useuserangaxisCmd->SetParameterName("useuserangaxis",true);
useuserangaxisCmd->SetDefaultValue(false);
surfnormCmd = new G4UIcmdWithABool("/gps/surfnorm",this);
surfnormCmd->SetGuidance("Makes a user-defined distribution with respect to surface normals rather than x,y,z axes.");
surfnormCmd->SetGuidance("Default is false");
@@ -228,7 +363,7 @@ G4GeneralParticleSourceMessenger::G4GeneralParticleSourceMessenger
energytypeCmd->SetGuidance("Sets energy distribution type");
energytypeCmd->SetParameterName("EnergyDis",true,true);
energytypeCmd->SetDefaultValue("Mono");
energytypeCmd->SetCandidates("Mono Lin Pow Exp Brem Bbody Cdg User Arb Epn");
energytypeCmd->SetCandidates("Mono Lin Pow Exp Gauss Brem Bbody Cdg User Arb Epn");
eminCmd = new G4UIcmdWithADoubleAndUnit("/gps/emin",this);
eminCmd->SetGuidance("Sets Emin");
@@ -243,42 +378,48 @@ G4GeneralParticleSourceMessenger::G4GeneralParticleSourceMessenger
emaxCmd->SetUnitCandidates("eV keV MeV GeV TeV PeV");
monoenergyCmd = new G4UIcmdWithADoubleAndUnit("/gps/monoenergy",this);
monoenergyCmd->SetGuidance("Sets Monoenergy");
monoenergyCmd->SetGuidance("Sets Monoenergy (obsolete, use gps/energy instead!)");
monoenergyCmd->SetParameterName("monoenergy",true,true);
monoenergyCmd->SetDefaultUnit("keV");
monoenergyCmd->SetUnitCandidates("eV keV MeV GeV TeV PeV");
engsigmaCmd = new G4UIcmdWithADoubleAndUnit("/gps/sigmae",this);
engsigmaCmd->SetGuidance("Sets the standard deviation for Gaussian energy dist.");
engsigmaCmd->SetParameterName("Sigmae",true,true);
engsigmaCmd->SetDefaultUnit("keV");
engsigmaCmd->SetUnitCandidates("eV keV MeV GeV TeV PeV");
alphaCmd = new G4UIcmdWithADouble("/gps/alpha",this);
alphaCmd->SetGuidance("Sets Alpha");
alphaCmd->SetGuidance("Sets Alpha (index) for power-law energy dist.");
alphaCmd->SetParameterName("alpha",true,true);
tempCmd = new G4UIcmdWithADouble("/gps/temp",this);
tempCmd->SetGuidance("Sets the temperature for Brem and BBody");
tempCmd->SetGuidance("Sets the temperature for Brem and BBody (in Kelvin)");
tempCmd->SetParameterName("temp",true,true);
ezeroCmd = new G4UIcmdWithADouble("/gps/ezero",this);
ezeroCmd->SetGuidance("Sets ezero exponential distributions");
ezeroCmd->SetGuidance("Sets ezero exponential distributions (in MeV)");
ezeroCmd->SetParameterName("ezero",true,true);
gradientCmd = new G4UIcmdWithADouble("/gps/gradient",this);
gradientCmd->SetGuidance("Sets the gradient for Lin distributions");
gradientCmd->SetGuidance("Sets the gradient for Lin distributions (in 1/MeV)");
gradientCmd->SetParameterName("gradient",true,true);
interceptCmd = new G4UIcmdWithADouble("/gps/intercept",this);
interceptCmd->SetGuidance("Sets the intercept for Lin distributions");
interceptCmd->SetGuidance("Sets the intercept for Lin distributions (in MeV)");
interceptCmd->SetParameterName("intercept",true,true);
calculateCmd = new G4UIcmdWithoutParameter("/gps/calculate",this);
calculateCmd->SetGuidance("Calculates distributions for Cdg and BBody");
energyspecCmd = new G4UIcmdWithABool("/gps/energyspec",this);
energyspecCmd->SetGuidance("Toggles between energy and momentum spectra");
energyspecCmd->SetGuidance("True for energy and false for momentum spectra");
energyspecCmd->SetParameterName("energyspec",true);
energyspecCmd->SetDefaultValue(true);
diffspecCmd = new G4UIcmdWithABool("/gps/diffspec",this);
diffspecCmd->SetGuidance("Toggles between differential and integral spectra");
diffspecCmd->SetParameterName("diffspec",true,true);
diffspecCmd->SetGuidance("True for differential and flase for integral spectra");
diffspecCmd->SetParameterName("diffspec",true);
diffspecCmd->SetDefaultValue(true);
// Biasing + histograms in general
@@ -288,6 +429,13 @@ G4GeneralParticleSourceMessenger::G4GeneralParticleSourceMessenger
histnameCmd->SetDefaultValue("biasx");
histnameCmd->SetCandidates("biasx biasy biasz biast biasp biase theta phi energy arb epn");
// re-set the histograms
resethistCmd = new G4UIcmdWithAString("/gps/resethist",this);
resethistCmd->SetGuidance("Re-Set the histogram ");
resethistCmd->SetParameterName("HistType",true,true);
resethistCmd->SetDefaultValue("energy");
resethistCmd->SetCandidates("biasx biasy biasz biast biasp biase theta phi energy arb epn");
histpointCmd = new G4UIcmdWith3Vector("/gps/histpoint",this);
histpointCmd->SetGuidance("Allows user to define a histogram");
histpointCmd->SetGuidance("Enter: Ehi Weight");
@@ -309,68 +457,6 @@ G4GeneralParticleSourceMessenger::G4GeneralParticleSourceMessenger
verbosityCmd->SetParameterName("level",false);
verbosityCmd->SetRange("level>=0 && level <=2");
particleCmd = new G4UIcmdWithAString("/gps/particle",this);
particleCmd->SetGuidance("Set particle to be generated.");
particleCmd->SetGuidance(" (geantino is default)");
particleCmd->SetGuidance(" (ion can be specified for shooting ions)");
particleCmd->SetParameterName("particleName",true);
particleCmd->SetDefaultValue("geantino");
G4String candidateList;
G4int nPtcl = particleTable->entries();
for(G4int i=0;i<nPtcl;i++)
{
candidateList += particleTable->GetParticleName(i);
candidateList += " ";
}
candidateList += "ion ";
particleCmd->SetCandidates(candidateList);
// SR1.3
// ionCmd = new UIcmdWithNucleusAndUnit("/gps/ion",this);
//ionCmd->SetGuidance("define the primary ion (a,z,e)");
//ionCmd->SetParameterName("A","Z","E",true);
//ionCmd->SetDefaultUnit("keV");
//ionCmd->SetUnitCandidates("keV MeV");
ionCmd = new G4UIcommand("/gps/ion",this);
ionCmd->SetGuidance("Set properties of ion to be generated.");
ionCmd->SetGuidance("[usage] /gun/ion Z A Q E");
ionCmd->SetGuidance(" Z:(int) AtomicNumber");
ionCmd->SetGuidance(" A:(int) AtomicMass");
ionCmd->SetGuidance(" Q:(int) Charge of Ion (in unit of e)");
ionCmd->SetGuidance(" E:(double) Excitation energy (in keV)");
G4UIparameter* param;
param = new G4UIparameter("Z",'i',false);
param->SetDefaultValue("1");
ionCmd->SetParameter(param);
param = new G4UIparameter("A",'i',false);
param->SetDefaultValue("1");
ionCmd->SetParameter(param);
param = new G4UIparameter("Q",'i',true);
param->SetDefaultValue("0");
ionCmd->SetParameter(param);
param = new G4UIparameter("E",'d',true);
param->SetDefaultValue("0.0");
ionCmd->SetParameter(param);
timeCmd = new G4UIcmdWithADoubleAndUnit("/gps/time",this);
timeCmd->SetGuidance("Set initial time of the particle.");
timeCmd->SetParameterName("t0",true,true);
timeCmd->SetDefaultUnit("ns");
//timeCmd->SetUnitCategory("Time");
//timeCmd->SetUnitCandidates("ns ms s");
polCmd = new G4UIcmdWith3Vector("/gps/polarization",this);
polCmd->SetGuidance("Set polarization.");
polCmd->SetParameterName("Px","Py","Pz",true,true);
polCmd->SetRange("Px>=-1.&&Px<=1.&&Py>=-1.&&Py<=1.&&Pz>=-1.&&Pz<=1.");
numberCmd = new G4UIcmdWithAnInteger("/gps/number",this);
numberCmd->SetGuidance("Set number of particles to be generated.");
numberCmd->SetParameterName("N",true,true);
numberCmd->SetRange("N>0");
}
G4GeneralParticleSourceMessenger::~G4GeneralParticleSourceMessenger()
@@ -385,6 +471,9 @@ G4GeneralParticleSourceMessenger::~G4GeneralParticleSourceMessenger()
delete halfzCmd;
delete radiusCmd;
delete radius0Cmd;
delete possigmarCmd;
delete possigmaxCmd;
delete possigmayCmd;
delete paralpCmd;
delete partheCmd;
delete parphiCmd;
@@ -397,12 +486,17 @@ G4GeneralParticleSourceMessenger::~G4GeneralParticleSourceMessenger()
delete maxthetaCmd;
delete minphiCmd;
delete maxphiCmd;
delete angsigmarCmd;
delete angsigmaxCmd;
delete angsigmayCmd;
delete useuserangaxisCmd;
delete surfnormCmd;
delete energytypeCmd;
delete eminCmd;
delete emaxCmd;
delete monoenergyCmd;
delete engsigmaCmd;
delete alphaCmd;
delete tempCmd;
delete ezeroCmd;
@@ -413,6 +507,7 @@ G4GeneralParticleSourceMessenger::~G4GeneralParticleSourceMessenger()
delete diffspecCmd;
delete histnameCmd;
delete resethistCmd;
delete histpointCmd;
delete arbintCmd;
@@ -423,6 +518,11 @@ G4GeneralParticleSourceMessenger::~G4GeneralParticleSourceMessenger()
delete polCmd;
delete numberCmd;
delete positionCmd;
delete directionCmd;
delete energyCmd;
delete listCmd;
delete gpsDirectory;
}
@@ -468,6 +568,18 @@ void G4GeneralParticleSourceMessenger::SetNewValue(G4UIcommand *command, G4Strin
{
fParticleGun->SetRadius0(radius0Cmd->GetNewDoubleValue(newValues));
}
else if(command == possigmarCmd)
{
fParticleGun->SetBeamSigmaInR(possigmarCmd->GetNewDoubleValue(newValues));
}
else if(command == possigmaxCmd)
{
fParticleGun->SetBeamSigmaInX(possigmaxCmd->GetNewDoubleValue(newValues));
}
else if(command == possigmayCmd)
{
fParticleGun->SetBeamSigmaInY(possigmayCmd->GetNewDoubleValue(newValues));
}
else if(command == paralpCmd)
{
fParticleGun->SetParAlpha(paralpCmd->GetNewDoubleValue(newValues));
@@ -514,6 +626,22 @@ void G4GeneralParticleSourceMessenger::SetNewValue(G4UIcommand *command, G4Strin
{
fParticleGun->SetMaxPhi(maxphiCmd->GetNewDoubleValue(newValues));
}
else if(command == angsigmarCmd)
{
fParticleGun->SetBeamSigmaInAngR(angsigmarCmd->GetNewDoubleValue(newValues));
}
else if(command == angsigmaxCmd)
{
fParticleGun->SetBeamSigmaInAngX(angsigmaxCmd->GetNewDoubleValue(newValues));
}
else if(command == angsigmayCmd)
{
fParticleGun->SetBeamSigmaInAngY(angsigmayCmd->GetNewDoubleValue(newValues));
}
else if(command == useuserangaxisCmd)
{
fParticleGun->SetUseUserAngAxis(useuserangaxisCmd->GetNewBoolValue(newValues));
}
else if(command == surfnormCmd)
{
fParticleGun->SetUserWRTSurface(surfnormCmd->GetNewBoolValue(newValues));
@@ -534,6 +662,10 @@ void G4GeneralParticleSourceMessenger::SetNewValue(G4UIcommand *command, G4Strin
{
fParticleGun->SetMonoEnergy(monoenergyCmd->GetNewDoubleValue(newValues));
}
else if(command == engsigmaCmd)
{
fParticleGun->SetBeamSigmaInE(engsigmaCmd->GetNewDoubleValue(newValues));
}
else if(command == alphaCmd)
{
fParticleGun->SetAlpha(alphaCmd->GetNewDoubleValue(newValues));
@@ -560,7 +692,6 @@ void G4GeneralParticleSourceMessenger::SetNewValue(G4UIcommand *command, G4Strin
}
else if(command == energyspecCmd)
{
G4cout << "here in energyspecCmd" << G4endl;
fParticleGun->InputEnergySpectra(energyspecCmd->GetNewBoolValue(newValues));
}
else if(command == diffspecCmd)
@@ -596,6 +727,10 @@ void G4GeneralParticleSourceMessenger::SetNewValue(G4UIcommand *command, G4Strin
if(histtype == "epn")
fParticleGun->EpnEnergyHisto(histpointCmd->GetNew3VectorValue(newValues));
}
else if(command == resethistCmd)
{
fParticleGun->ReSetHist(newValues);
}
else if(command == arbintCmd)
{
fParticleGun->ArbInterpolate(newValues);
@@ -659,6 +794,23 @@ void G4GeneralParticleSourceMessenger::SetNewValue(G4UIcommand *command, G4Strin
G4cout << G4endl;
}
}
else if( command==listCmd )
{ particleTable->DumpTable(); }
else if( command==directionCmd )
{
fParticleGun->SetAngDistType("planar");
fParticleGun->SetParticleMomentumDirection(directionCmd->GetNew3VectorValue(newValues));
}
else if( command==energyCmd )
{
fParticleGun->SetEnergyDisType("Mono");
fParticleGun->SetMonoEnergy(energyCmd->GetNewDoubleValue(newValues));
}
else if( command==positionCmd )
{
fParticleGun->SetPosDisType("Point");
fParticleGun->SetCentreCoords(positionCmd->GetNew3VectorValue(newValues));
}
else
{
G4cout << "Error entering command" << G4endl;
@@ -686,3 +838,8 @@ G4String G4GeneralParticleSourceMessenger::GetCurrentValue(G4UIcommand * command
return cv;
}
+24 -16
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4HEPEvtInterface.cc,v 1.4.2.1 2001/06/28 19:07:57 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4HEPEvtInterface.cc,v 1.7 2001/11/20 23:21:41 asaim Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// --------------------------------------------------------------------
@@ -45,13 +45,25 @@ G4HEPEvtInterface::G4HEPEvtInterface(char* evfile)
else {
G4Exception("G4HEPEvtInterface:: cannot open file.");
}
G4ThreeVector zero;
particle_position = zero;
particle_time = 0.0;
}
G4HEPEvtInterface::G4HEPEvtInterface(G4String evfile)
{
const char* fn = evfile.data();
inputFile.open((char*)fn);
fileName = evfile;
if (inputFile) {
fileName = evfile;
}
else {
G4Exception("G4HEPEvtInterface:: cannot open file.");
}
G4ThreeVector zero;
particle_position = zero;
particle_time = 0.0;
}
G4HEPEvtInterface::~G4HEPEvtInterface()
@@ -59,7 +71,7 @@ G4HEPEvtInterface::~G4HEPEvtInterface()
void G4HEPEvtInterface::GeneratePrimaryVertex(G4Event* evt)
{
int NHEP; // number of entries
G4int NHEP; // number of entries
inputFile >> NHEP;
if( inputFile.eof() )
{
@@ -67,7 +79,7 @@ void G4HEPEvtInterface::GeneratePrimaryVertex(G4Event* evt)
return;
}
for( int IHEP=0; IHEP<NHEP; IHEP++ )
for( G4int IHEP=0; IHEP<NHEP; IHEP++ )
{
G4int ISTHEP; // status code
G4int IDHEP; // PDG code
@@ -99,14 +111,14 @@ void G4HEPEvtInterface::GeneratePrimaryVertex(G4Event* evt)
// make connection between daughter particles decayed from
// the same mother
for( int i=0; i<HPlist.size(); i++ )
for( size_t i=0; i<HPlist.size(); i++ )
{
if( HPlist[i]->GetJDAHEP1() > 0 ) // it has daughters
{
int jda1 = HPlist[i]->GetJDAHEP1()-1; // FORTRAN index starts from 1
int jda2 = HPlist[i]->GetJDAHEP2()-1; // but C++ starts from 0.
G4int jda1 = HPlist[i]->GetJDAHEP1()-1; // FORTRAN index starts from 1
G4int jda2 = HPlist[i]->GetJDAHEP2()-1; // but C++ starts from 0.
G4PrimaryParticle* mother = HPlist[i]->GetTheParticle();
for( int j=jda1; j<=jda2; j++ )
for( G4int j=jda1; j<=jda2; j++ )
{
G4PrimaryParticle* daughter = HPlist[j]->GetTheParticle();
if(HPlist[j]->GetISTHEP()>0)
@@ -119,14 +131,10 @@ void G4HEPEvtInterface::GeneratePrimaryVertex(G4Event* evt)
}
// create G4PrimaryVertex object
G4double x0 = 0.; // vertex point X
G4double y0 = 0.; // vertex point Y
G4double z0 = 0.; // vertex point Z
G4double t0 = 0.; // vertex time
G4PrimaryVertex* vertex = new G4PrimaryVertex(x0,y0,z0,t0);
G4PrimaryVertex* vertex = new G4PrimaryVertex(particle_position,particle_time);
// put initial particles to the vertex
for( int ii=0; ii<HPlist.size(); ii++ )
for( size_t ii=0; ii<HPlist.size(); ii++ )
{
if( HPlist[ii]->GetISTHEP() > 0 ) // ISTHEP of daughters had been
// set to negative
@@ -138,7 +146,7 @@ void G4HEPEvtInterface::GeneratePrimaryVertex(G4Event* evt)
// clear G4HEPEvtParticles
//HPlist.clearAndDestroy();
for(G4int iii=0;iii<HPlist.size();iii++)
for(size_t iii=0;iii<HPlist.size();iii++)
{ delete HPlist[iii]; }
HPlist.clear();
+4 -4
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4HEPEvtParticle.cc,v 1.2.4.1 2001/06/28 19:07:57 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4HEPEvtParticle.cc,v 1.4 2001/07/13 15:01:53 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
@@ -45,9 +45,9 @@ const G4HEPEvtParticle &
G4HEPEvtParticle::operator=(const G4HEPEvtParticle &right)
{ return *this; }
int G4HEPEvtParticle::operator==(const G4HEPEvtParticle &right) const
G4int G4HEPEvtParticle::operator==(const G4HEPEvtParticle &right) const
{ return false; }
int G4HEPEvtParticle::operator!=(const G4HEPEvtParticle &right) const
G4int G4HEPEvtParticle::operator!=(const G4HEPEvtParticle &right) const
{ return true; }
+6 -6
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4ParticleGun.cc,v 1.3.4.1 2001/06/28 19:07:57 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4ParticleGun.cc,v 1.6 2001/11/20 23:21:41 asaim Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
// G4ParticleGun
@@ -54,7 +54,7 @@ G4ParticleGun::G4ParticleGun
void G4ParticleGun::SetInitialValues()
{
NumberOfParticlesToBeGenerated = 1;
particle_definition = NULL;
particle_definition = 0;
G4ThreeVector zero;
particle_momentum_direction = (G4ParticleMomentum)zero;
particle_energy = 0.0;
@@ -79,7 +79,7 @@ void G4ParticleGun::SetParticleDefinition
void G4ParticleGun::SetParticleMomentum(G4ParticleMomentum aMomentum)
{
if(particle_definition==NULL)
if(particle_definition==0)
{
G4cout <<"Particle Definition not defined yet for G4ParticleGun"<< G4endl;
G4cout <<"Zero Mass is assumed"<<G4endl;
@@ -107,7 +107,7 @@ void G4ParticleGun::SetParticleMomentum(G4ParticleMomentum aMomentum)
void G4ParticleGun::GeneratePrimaryVertex(G4Event* evt)
{
if(particle_definition==NULL) return;
if(particle_definition==0) return;
// create a new vertex
G4PrimaryVertex* vertex =
@@ -120,7 +120,7 @@ void G4ParticleGun::GeneratePrimaryVertex(G4Event* evt)
G4double px = pmom*particle_momentum_direction.x();
G4double py = pmom*particle_momentum_direction.y();
G4double pz = pmom*particle_momentum_direction.z();
for( int i=0; i<NumberOfParticlesToBeGenerated; i++ )
for( G4int i=0; i<NumberOfParticlesToBeGenerated; i++ )
{
G4PrimaryParticle* particle =
new G4PrimaryParticle(particle_definition,px,py,pz);
+4 -5
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4ParticleGunMessenger.cc,v 1.4.4.1 2001/06/28 19:07:57 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4ParticleGunMessenger.cc,v 1.7 2001/10/11 13:34:59 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
#include "G4ParticleGunMessenger.hh"
@@ -39,10 +39,9 @@
#include "G4UIcmdWith3VectorAndUnit.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4ios.hh"
#include "G4Tokenizer.hh"
#include "g4std/iomanip"
#include "g4rw/ctoken.h"
#include "g4rw/rstream.h"
#include "g4std/strstream"
G4ParticleGunMessenger::G4ParticleGunMessenger(G4ParticleGun * fPtclGun)
@@ -164,7 +163,7 @@ void G4ParticleGunMessenger::SetNewValue(G4UIcommand * command,G4String newValue
} else {
fShootIon = false;
G4ParticleDefinition* pd = particleTable->FindParticle(newValues);
if(pd != NULL)
if(pd != 0)
{ fParticleGun->SetParticleDefinition( pd ); }
}
}
+15 -15
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4PrimaryParticle.cc,v 1.5.2.1 2001/06/28 19:07:57 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4PrimaryParticle.cc,v 1.7 2001/07/13 15:01:54 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
#include "G4PrimaryParticle.hh"
@@ -33,42 +33,42 @@
G4Allocator<G4PrimaryParticle> aPrimaryParticleAllocator;
G4PrimaryParticle::G4PrimaryParticle()
:PDGcode(0),G4code(NULL),Px(0.),Py(0.),Pz(0.),
nextParticle(NULL),daughterParticle(NULL),trackID(-1),
:PDGcode(0),G4code(0),Px(0.),Py(0.),Pz(0.),
nextParticle(0),daughterParticle(0),trackID(-1),
mass(0.),polX(0.),polY(0.),polZ(0.),Weight0(1.0),properTime(0.0)
{;}
G4PrimaryParticle::G4PrimaryParticle(G4int Pcode)
:PDGcode(Pcode),Px(0.),Py(0.),Pz(0.),
nextParticle(NULL),daughterParticle(NULL),trackID(-1),
nextParticle(0),daughterParticle(0),trackID(-1),
mass(0.),polX(0.),polY(0.),polZ(0.),Weight0(1.0),properTime(0.0)
{ G4code = G4ParticleTable::GetParticleTable()->FindParticle(Pcode); }
G4PrimaryParticle::G4PrimaryParticle(G4int Pcode,
G4double px,G4double py,G4double pz)
:PDGcode(Pcode),Px(px),Py(py),Pz(pz),
nextParticle(NULL),daughterParticle(NULL),trackID(-1),
nextParticle(0),daughterParticle(0),trackID(-1),
mass(0.),polX(0.),polY(0.),polZ(0.),Weight0(1.0),properTime(0.0)
{ G4code = G4ParticleTable::GetParticleTable()->FindParticle(Pcode); }
G4PrimaryParticle::G4PrimaryParticle(G4ParticleDefinition* Gcode)
:G4code(Gcode),Px(0.),Py(0.),Pz(0.),
nextParticle(NULL),daughterParticle(NULL),trackID(-1),
nextParticle(0),daughterParticle(0),trackID(-1),
mass(0.),polX(0.),polY(0.),polZ(0.),Weight0(1.0),properTime(0.0)
{ PDGcode = Gcode->GetPDGEncoding(); }
G4PrimaryParticle::G4PrimaryParticle(G4ParticleDefinition* Gcode,
G4double px,G4double py,G4double pz)
:G4code(Gcode),Px(px),Py(py),Pz(pz),
nextParticle(NULL),daughterParticle(NULL),trackID(-1),
nextParticle(0),daughterParticle(0),trackID(-1),
mass(0.),polX(0.),polY(0.),polZ(0.),Weight0(1.0),properTime(0.0)
{ PDGcode = Gcode->GetPDGEncoding(); }
G4PrimaryParticle::~G4PrimaryParticle()
{
if(nextParticle != NULL)
if(nextParticle != 0)
{ delete nextParticle; }
if(daughterParticle != NULL)
if(daughterParticle != 0)
{ delete daughterParticle; }
}
@@ -87,15 +87,15 @@ void G4PrimaryParticle::SetG4code(G4ParticleDefinition* Gcode)
const G4PrimaryParticle &
G4PrimaryParticle::operator=(const G4PrimaryParticle &right)
{ return *this; }
int G4PrimaryParticle::operator==(const G4PrimaryParticle &right) const
G4int G4PrimaryParticle::operator==(const G4PrimaryParticle &right) const
{ return false; }
int G4PrimaryParticle::operator!=(const G4PrimaryParticle &right) const
G4int G4PrimaryParticle::operator!=(const G4PrimaryParticle &right) const
{ return true; }
void G4PrimaryParticle::Print() const
{
G4cout << "==== PDGcode " << PDGcode << " Particle name ";
if(G4code != NULL)
if(G4code != 0)
{ G4cout << G4code->GetParticleName() << G4endl; }
else
{ G4cout << "is not defined in G4." << G4endl; }
@@ -105,12 +105,12 @@ void G4PrimaryParticle::Print() const
G4cout << " Weight : " << Weight0 << G4endl;
if(properTime>0.0)
{ G4cout << " PreAssigned proper decay time : " << properTime/ns << " (nsec)" << G4endl; }
if(daughterParticle != NULL)
if(daughterParticle != 0)
{
G4cout << ">>>> Daughters" << G4endl;
daughterParticle->Print();
}
if(nextParticle != NULL)
if(nextParticle != 0)
{ nextParticle->Print(); }
else
{ G4cout << "<<<< End of link" << G4endl; }
+32 -8
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4PrimaryTransformer.cc,v 1.8.2.1 2001/06/28 19:07:57 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4PrimaryTransformer.cc,v 1.13 2001/11/22 18:53:13 asaim Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
#include "G4PrimaryTransformer.hh"
@@ -33,10 +33,16 @@
#include "G4Track.hh"
#include "G4ThreeVector.hh"
#include "G4DecayProducts.hh"
#include "G4TransportationManager.hh"
#include "G4Navigator.hh"
#include "G4VPhysicalVolume.hh"
#include "G4LogicalVolume.hh"
#include "G4VSolid.hh"
#include "G4UnitsTable.hh"
#include "G4ios.hh"
G4PrimaryTransformer::G4PrimaryTransformer()
:verboseLevel(0)
:verboseLevel(0),trackID(0)
{
particleTable = G4ParticleTable::GetParticleTable();
}
@@ -44,15 +50,17 @@ G4PrimaryTransformer::G4PrimaryTransformer()
G4PrimaryTransformer::~G4PrimaryTransformer()
{;}
G4TrackVector* G4PrimaryTransformer::GimmePrimaries(G4Event* anEvent)
G4TrackVector* G4PrimaryTransformer::GimmePrimaries(G4Event* anEvent,G4int trackIDCounter)
{
trackID = trackIDCounter;
//TV.clearAndDestroy();
for( int ii=0; ii<TV.size();ii++)
for( size_t ii=0; ii<TV.size();ii++)
{ delete TV[ii]; }
TV.clear();
G4int n_vertex = anEvent->GetNumberOfPrimaryVertex();
if(n_vertex==0) return NULL;
for( int i=0; i<n_vertex; i++ )
if(n_vertex==0) return 0;
for( G4int i=0; i<n_vertex; i++ )
{ GenerateTracks( anEvent->GetPrimaryVertex(i) ); }
return &TV;
}
@@ -76,8 +84,20 @@ void G4PrimaryTransformer::GenerateTracks(G4PrimaryVertex* primaryVertex)
}
#endif
//Check whether the vertex is inside the world volume
G4Navigator* navi =
G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking();
G4VSolid* theWorldSolid = navi->GetWorldVolume()->GetLogicalVolume()->GetSolid();
if(theWorldSolid->Inside(G4ThreeVector(X0,Y0,Z0))==kOutside)
{
G4cerr << "Primary vertex "
<< G4BestUnit(G4ThreeVector(X0,Y0,Z0),G4String("Length"))
<< " is outside of the world volume." << G4endl;
G4Exception("G4PrimaryTransformer::Primary vertex outside of the world");
}
G4PrimaryParticle* primaryParticle = primaryVertex->GetPrimary();
while( primaryParticle != NULL )
while( primaryParticle != 0 )
{
GenerateSingleTrack( primaryParticle, X0, Y0, Z0, T0, WV );
primaryParticle = primaryParticle->GetNext();
@@ -134,6 +154,10 @@ void G4PrimaryTransformer::GenerateSingleTrack
SetDecayProducts( primaryParticle, DP );
// Create G4Track object
G4Track* track = new G4Track(DP,t0,G4ThreeVector(x0,y0,z0));
// Set trackID and let primary particle know it
trackID++;
track->SetTrackID(trackID);
primaryParticle->SetTrackID(trackID);
// Set parentID to 0 as a primary particle
track->SetParentID(0);
// Set weight ( vertex weight * particle weight )
+13 -15
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4PrimaryVertex.cc,v 1.3.4.1 2001/06/28 19:07:57 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4PrimaryVertex.cc,v 1.5 2001/07/13 15:01:54 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
#include "G4PrimaryVertex.hh"
@@ -31,19 +31,19 @@
G4Allocator<G4PrimaryVertex> aPrimaryVertexAllocator;
G4PrimaryVertex::G4PrimaryVertex()
:X0(0.),Y0(0.),Z0(0.),T0(0.),numberOfParticle(0),nextVertex(NULL),
theParticle(NULL),theTail(NULL),Weight0(1.0)
:X0(0.),Y0(0.),Z0(0.),T0(0.),theParticle(0),theTail(0),
nextVertex(0),numberOfParticle(0),Weight0(1.0)
{;}
G4PrimaryVertex::G4PrimaryVertex(
G4double x0,G4double y0,G4double z0,G4double t0)
:X0(x0),Y0(y0),Z0(z0),T0(t0),numberOfParticle(0),nextVertex(NULL),
theParticle(NULL),theTail(NULL),Weight0(1.0)
:X0(x0),Y0(y0),Z0(z0),T0(t0),theParticle(0),theTail(0),
nextVertex(0),numberOfParticle(0),Weight0(1.0)
{;}
G4PrimaryVertex::G4PrimaryVertex(G4ThreeVector xyz0,G4double t0)
:T0(t0),numberOfParticle(0),nextVertex(NULL),
theParticle(NULL),theTail(NULL),Weight0(1.0)
:T0(t0),theParticle(0),theTail(0),
nextVertex(0),numberOfParticle(0),Weight0(1.0)
{
X0=xyz0.x();
Y0=xyz0.y();
@@ -52,18 +52,18 @@ G4PrimaryVertex::G4PrimaryVertex(G4ThreeVector xyz0,G4double t0)
G4PrimaryVertex::~G4PrimaryVertex()
{
if(theParticle != NULL)
if(theParticle != 0)
{ delete theParticle; }
if(nextVertex != NULL)
if(nextVertex != 0)
{ delete nextVertex; }
}
const G4PrimaryVertex &
G4PrimaryVertex::operator=(const G4PrimaryVertex &right)
{ return *this; }
int G4PrimaryVertex::operator==(const G4PrimaryVertex &right) const
G4int G4PrimaryVertex::operator==(const G4PrimaryVertex &right) const
{ return false; }
int G4PrimaryVertex::operator!=(const G4PrimaryVertex &right) const
G4int G4PrimaryVertex::operator!=(const G4PrimaryVertex &right) const
{ return true; }
void G4PrimaryVertex::Print() const
@@ -73,11 +73,9 @@ void G4PrimaryVertex::Print() const
<< " Weight " << Weight0 << G4endl;
G4cout << "#### Primary particles" << G4endl;
G4PrimaryParticle* aPrim = theParticle;
if(aPrim != NULL)
if(aPrim != 0)
{
aPrim->Print();
aPrim = aPrim->GetNext();
}
}
+127 -9
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4StackManager.cc,v 1.3.4.1 2001/06/28 19:07:58 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4StackManager.cc,v 1.6 2001/07/19 00:14:17 asaim Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// Last Modification : 09/Dec/96 M.Asai
@@ -35,7 +35,7 @@
#include "G4ios.hh"
G4StackManager::G4StackManager()
:verboseLevel(0),userStackingAction(NULL)
:userStackingAction(0),verboseLevel(0),numberOfAdditionalWaitingStacks(0)
{
theMessenger = new G4StackingMessenger(this);
urgentStack = new G4TrackStack;
@@ -50,13 +50,18 @@ G4StackManager::~G4StackManager()
delete waitingStack;
delete postponeStack;
delete theMessenger;
if(numberOfAdditionalWaitingStacks>0) {
for(int i=0;i<numberOfAdditionalWaitingStacks;i++) {
delete additionalWaitingStacks[i];
}
}
}
const G4StackManager & G4StackManager::operator=
(const G4StackManager &) { return *this; }
int G4StackManager::operator==(const G4StackManager &)
G4int G4StackManager::operator==(const G4StackManager &)
const{ return false; }
int G4StackManager::operator!=(const G4StackManager &)
G4int G4StackManager::operator!=(const G4StackManager &)
const{ return true; }
G4int G4StackManager::PushOneTrack(G4Track *newTrack,G4VTrajectory *newTrajectory)
@@ -96,6 +101,14 @@ G4int G4StackManager::PushOneTrack(G4Track *newTrack,G4VTrajectory *newTrajector
break;
case fKill:
break;
default:
G4int i = classification - 10;
if(i<1||i>numberOfAdditionalWaitingStacks) {
G4Exception("G4StackManager : invalid classification");
} else {
additionalWaitingStacks[i-1]->PushToStack( newStackedTrack );
}
break;
}
}
@@ -120,13 +133,22 @@ G4Track * G4StackManager::PopNextTrack(G4VTrajectory**newTrajectory)
<< " waiting tracks are re-classified to" << G4endl;
#endif
waitingStack->TransferTo(urgentStack);
if(numberOfAdditionalWaitingStacks>0) {
for(int i=0;i<numberOfAdditionalWaitingStacks;i++) {
if(i==0) {
additionalWaitingStacks[0]->TransferTo(waitingStack);
} else {
additionalWaitingStacks[i]->TransferTo(additionalWaitingStacks[i-1]);
}
}
}
if(userStackingAction) userStackingAction->NewStage();
#ifdef G4VERBOSE
if( verboseLevel > 0 ) G4cout << " " << GetNUrgentTrack()
<< " urgent tracks and " << GetNWaitingTrack()
<< " waiting tracks." << G4endl;
#endif
if( ( GetNUrgentTrack()==0 ) && ( GetNWaitingTrack()==0 ) ) return NULL;
if( ( GetNUrgentTrack()==0 ) && ( GetNWaitingTrack()==0 ) ) return 0;
}
G4StackedTrack * selectedStackedTrack = urgentStack->PopFromStack();
@@ -157,7 +179,7 @@ void G4StackManager::ReClassify()
if( GetNUrgentTrack() == 0 ) return;
urgentStack->TransferTo(&tmpStack);
while( (aStackedTrack=tmpStack.PopFromStack()) != NULL )
while( (aStackedTrack=tmpStack.PopFromStack()) != 0 )
{
G4ClassificationOfNewTrack classification =
userStackingAction->ClassifyNewTrack( aStackedTrack->GetTrack() );
@@ -177,6 +199,14 @@ void G4StackManager::ReClassify()
case fPostpone:
postponeStack->PushToStack( aStackedTrack );
break;
default:
G4int i = classification - 10;
if(i<1||i>numberOfAdditionalWaitingStacks) {
G4Exception("G4StackManager : invalid classification");
} else {
additionalWaitingStacks[i-1]->PushToStack( aStackedTrack );
}
break;
}
}
}
@@ -202,10 +232,9 @@ G4int G4StackManager::PrepareNewEvent()
postponeStack->TransferTo(&tmpStack);
while( (aStackedTrack=tmpStack.PopFromStack()) != NULL )
while( (aStackedTrack=tmpStack.PopFromStack()) != 0 )
{
G4Track* aTrack = aStackedTrack->GetTrack();
G4VTrajectory* aTrajectory = aStackedTrack->GetTrajectory();
aTrack->SetParentID(-1);
G4ClassificationOfNewTrack classification;
if(userStackingAction)
@@ -234,6 +263,14 @@ G4int G4StackManager::PrepareNewEvent()
break;
case fKill:
break;
default:
G4int i = classification - 10;
if(i<1||i>numberOfAdditionalWaitingStacks) {
G4Exception("G4StackManager : invalid classification");
} else {
additionalWaitingStacks[i-1]->PushToStack( aStackedTrack );
}
break;
}
}
}
@@ -242,4 +279,85 @@ G4int G4StackManager::PrepareNewEvent()
return n_passedFromPrevious;
}
void G4StackManager::SetNumberOfAdditionalWaitingStacks(G4int iAdd)
{
if(iAdd > numberOfAdditionalWaitingStacks)
{
for(int i=numberOfAdditionalWaitingStacks;i<iAdd;i++)
{
G4TrackStack* newStack = new G4TrackStack;
additionalWaitingStacks.push_back(newStack);
}
numberOfAdditionalWaitingStacks = iAdd;
}
else if (iAdd < numberOfAdditionalWaitingStacks)
{
for(int i=numberOfAdditionalWaitingStacks;i>iAdd;i--)
{
delete additionalWaitingStacks[i];
}
}
}
void G4StackManager::TransferStackedTracks(G4ClassificationOfNewTrack origin, G4ClassificationOfNewTrack destination)
{
G4TrackStack* originStack = 0;
switch(origin)
{
case fUrgent:
originStack = urgentStack;
break;
case fWaiting:
originStack = waitingStack;
break;
case fPostpone:
originStack = postponeStack;
break;
case fKill:
break;
default:
int i = origin - 10;
if(i<=numberOfAdditionalWaitingStacks) originStack = additionalWaitingStacks[i-1];
break;
}
if(!originStack) return;
if(destination==fKill)
{
G4StackedTrack * aStackedTrack;
while( (aStackedTrack=originStack->PopFromStack()) != 0 )
{
delete aStackedTrack->GetTrack();
delete aStackedTrack;
}
}
else
{
G4TrackStack* targetStack = 0;
switch(destination)
{
case fUrgent:
targetStack = urgentStack;
break;
case fWaiting:
targetStack = waitingStack;
break;
case fPostpone:
targetStack = postponeStack;
break;
default:
int i = origin - 10;
if(i<=numberOfAdditionalWaitingStacks) targetStack = additionalWaitingStacks[i-1];
break;
}
if(!targetStack) return;
if(originStack==targetStack) return;
originStack->TransferTo(targetStack);
}
return;
}
+8 -8
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4StackedTrack.cc,v 1.3.4.1 2001/06/28 19:07:58 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4StackedTrack.cc,v 1.5 2001/07/13 15:01:55 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// Last Modification : 02/Feb/96 M.Asai
@@ -33,13 +33,13 @@
G4Allocator<G4StackedTrack> aStackedTrackAllocator;
G4StackedTrack::G4StackedTrack()
:track(NULL),trajectory(NULL),priorityWeight(0.),
previousStackedTrack(NULL),nextStackedTrack(NULL)
:priorityWeight(0.),track(0),trajectory(0),
previousStackedTrack(0),nextStackedTrack(0)
{ }
G4StackedTrack::G4StackedTrack(G4Track * newTrack, G4VTrajectory * aTrajectory)
:track(newTrack),trajectory(aTrajectory),priorityWeight(0.),
previousStackedTrack(NULL),nextStackedTrack(NULL)
:priorityWeight(0.),track(newTrack),trajectory(aTrajectory),
previousStackedTrack(0),nextStackedTrack(0)
{ }
G4StackedTrack::~G4StackedTrack()
@@ -47,9 +47,9 @@ G4StackedTrack::~G4StackedTrack()
const G4StackedTrack & G4StackedTrack::operator=(const G4StackedTrack &right)
{ return *this; }
int G4StackedTrack::operator==(const G4StackedTrack &right) const
G4int G4StackedTrack::operator==(const G4StackedTrack &right) const
{ return false; }
int G4StackedTrack::operator!=(const G4StackedTrack &right) const
G4int G4StackedTrack::operator!=(const G4StackedTrack &right) const
{ return true; }
+2 -2
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4StackingMessenger.cc,v 1.2.4.1 2001/06/28 19:07:58 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4StackingMessenger.cc,v 1.3 2001/07/11 09:58:54 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
// --------------------------------------------------------------------
+14 -14
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4TrackStack.cc,v 1.2.4.1 2001/06/28 19:07:58 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4TrackStack.cc,v 1.4 2001/07/13 15:01:55 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// Last Modification : 09/Dec/96 M.Asai
@@ -31,7 +31,7 @@
#include "G4TrackStack.hh"
G4TrackStack::G4TrackStack()
:n_stackedTrack(0),firstStackedTrack(NULL),lastStackedTrack(NULL)
:n_stackedTrack(0),firstStackedTrack(0),lastStackedTrack(0)
{;}
G4TrackStack::~G4TrackStack()
@@ -67,13 +67,13 @@ void G4TrackStack::TransferTo(G4TrackStack * aStack)
}
n_stackedTrack = 0;
firstStackedTrack = NULL;
lastStackedTrack = NULL;
firstStackedTrack = 0;
lastStackedTrack = 0;
}
G4StackedTrack * G4TrackStack::PopFromStack()
{
if( n_stackedTrack == 0 ) return NULL;
if( n_stackedTrack == 0 ) return 0;
G4StackedTrack * aStackedTrack = lastStackedTrack;
GrabFromStack( aStackedTrack );
return aStackedTrack;
@@ -83,7 +83,7 @@ void G4TrackStack::PushToStack( G4StackedTrack * aStackedTrack )
{
if( n_stackedTrack == 0 )
{
aStackedTrack->SetPrevious( NULL );
aStackedTrack->SetPrevious( 0 );
firstStackedTrack = aStackedTrack;
}
else
@@ -99,22 +99,22 @@ void G4TrackStack::GrabFromStack( G4StackedTrack * aStackedTrack )
{
if( n_stackedTrack == 1 )
{
firstStackedTrack = NULL;
lastStackedTrack = NULL;
firstStackedTrack = 0;
lastStackedTrack = 0;
}
else
{
if( aStackedTrack == firstStackedTrack )
{
firstStackedTrack = aStackedTrack->GetNext();
firstStackedTrack->SetPrevious( NULL );
firstStackedTrack->SetPrevious( 0 );
}
else
{
if( aStackedTrack == lastStackedTrack )
{
lastStackedTrack = aStackedTrack->GetPrevious();
lastStackedTrack->SetNext( NULL );
lastStackedTrack->SetNext( 0 );
}
else
{
@@ -136,7 +136,7 @@ void G4TrackStack::clear()
if ( n_stackedTrack == 0 ) return;
// delete tracks in the stack
while( aStackedTrack != NULL )
while( aStackedTrack != 0 )
{
nextStackedTrack = aStackedTrack->GetNext();
delete aStackedTrack->GetTrack();
@@ -144,8 +144,8 @@ void G4TrackStack::clear()
aStackedTrack = nextStackedTrack;
}
n_stackedTrack = 0;
firstStackedTrack = NULL;
lastStackedTrack = NULL;
firstStackedTrack = 0;
lastStackedTrack = 0;
}
+2 -2
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4UserEventAction.cc,v 1.3.4.1 2001/06/28 19:07:58 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4UserEventAction.cc,v 1.4 2001/07/11 09:58:54 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
#include "G4UserEventAction.hh"
+2 -2
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4UserStackingAction.cc,v 1.3.4.1 2001/06/28 19:07:58 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4UserStackingAction.cc,v 1.4 2001/07/11 09:58:54 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
#include "G4UserStackingAction.hh"
+2 -2
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4VPrimaryGenerator.cc,v 1.2.4.1 2001/06/28 19:07:58 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4VPrimaryGenerator.cc,v 1.3 2001/07/11 09:58:54 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
// G4VPrimaryGenerator