Import Geant4 9.6.0 source tree
This commit is contained in:
@@ -23,8 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4AdjointPosOnPhysVolGenerator.cc,v 1.2 2009-11-18 17:57:59 gcosmo Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Class Name: G4AdjointCrossSurfChecker
|
||||
@@ -114,15 +113,15 @@ G4double G4AdjointPosOnPhysVolGenerator::ComputeAreaOfExtSurface()
|
||||
}
|
||||
////////////////////////////////////////////////////
|
||||
//
|
||||
G4double G4AdjointPosOnPhysVolGenerator::ComputeAreaOfExtSurface(G4int NStat)
|
||||
G4double G4AdjointPosOnPhysVolGenerator::ComputeAreaOfExtSurface(G4int NStats)
|
||||
{
|
||||
return ComputeAreaOfExtSurface(theSolid,NStat);
|
||||
return ComputeAreaOfExtSurface(theSolid,NStats);
|
||||
}
|
||||
////////////////////////////////////////////////////
|
||||
//
|
||||
G4double G4AdjointPosOnPhysVolGenerator::ComputeAreaOfExtSurface(G4double epsilon)
|
||||
G4double G4AdjointPosOnPhysVolGenerator::ComputeAreaOfExtSurface(G4double eps)
|
||||
{
|
||||
return ComputeAreaOfExtSurface(theSolid,epsilon);
|
||||
return ComputeAreaOfExtSurface(theSolid,eps);
|
||||
}
|
||||
////////////////////////////////////////////////////
|
||||
//
|
||||
@@ -132,15 +131,14 @@ G4double G4AdjointPosOnPhysVolGenerator::ComputeAreaOfExtSurface(G4VSolid* aSoli
|
||||
}
|
||||
////////////////////////////////////////////////////
|
||||
//
|
||||
G4double G4AdjointPosOnPhysVolGenerator::ComputeAreaOfExtSurface(G4VSolid* aSolid,G4int NStat)
|
||||
G4double G4AdjointPosOnPhysVolGenerator::ComputeAreaOfExtSurface(G4VSolid* aSolid,G4int NStats)
|
||||
{
|
||||
if (ModelOfSurfaceSource == "OnSolid" ){
|
||||
if (UseSphere){
|
||||
return ComputeAreaOfExtSurfaceStartingFromSphere(aSolid,NStat);
|
||||
|
||||
return ComputeAreaOfExtSurfaceStartingFromSphere(aSolid,NStats);
|
||||
}
|
||||
else {
|
||||
return ComputeAreaOfExtSurfaceStartingFromBox(aSolid,NStat);
|
||||
return ComputeAreaOfExtSurfaceStartingFromBox(aSolid,NStats);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -151,10 +149,10 @@ G4double G4AdjointPosOnPhysVolGenerator::ComputeAreaOfExtSurface(G4VSolid* aSoli
|
||||
}
|
||||
////////////////////////////////////////////////////
|
||||
//
|
||||
G4double G4AdjointPosOnPhysVolGenerator::ComputeAreaOfExtSurface(G4VSolid* aSolid,G4double epsilon)
|
||||
G4double G4AdjointPosOnPhysVolGenerator::ComputeAreaOfExtSurface(G4VSolid* aSolid,G4double eps)
|
||||
{
|
||||
G4int Nstat = G4int(1./(epsilon*epsilon));
|
||||
return ComputeAreaOfExtSurface(aSolid,Nstat);
|
||||
G4int Nstats = G4int(1./(eps*eps));
|
||||
return ComputeAreaOfExtSurface(aSolid,Nstats);
|
||||
}
|
||||
////////////////////////////////////////////////////
|
||||
void G4AdjointPosOnPhysVolGenerator::GenerateAPositionOnTheExtSurfaceOfASolid(G4VSolid* aSolid,G4ThreeVector& p, G4ThreeVector& direction)
|
||||
|
||||
@@ -23,8 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4AdjointPrimaryGenerator.cc,v 1.2 2009-11-18 17:57:59 gcosmo Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Class Name: G4AdjointCrossSurfChecker
|
||||
@@ -35,6 +34,7 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "G4AdjointPrimaryGenerator.hh"
|
||||
#include "G4PhysicalConstants.hh"
|
||||
#include "G4Event.hh"
|
||||
#include "G4SingleParticleSource.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
|
||||
@@ -23,8 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4AdjointStackingAction.cc,v 1.2 2009-11-18 17:57:59 gcosmo Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Class Name: G4AdjointCrossSurfChecker
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4CellScorer.cc,v 1.4 2006-06-29 18:09:31 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
@@ -41,7 +40,15 @@
|
||||
#include "G4Event.hh"
|
||||
|
||||
G4CellScorer::G4CellScorer()
|
||||
{}
|
||||
{
|
||||
G4cout << "--------------------------------------------------------" << G4endl
|
||||
<< "WARNING: Class <G4CellScorer> is now obsolete |" << G4endl
|
||||
<< " and will be removed starting from next Geant4 |" << G4endl
|
||||
<< " major release. Please, consider switching to |" << G4endl
|
||||
<< " general purpose scoring functionality. |" << G4endl
|
||||
<< "--------------------------------------------------------"
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
G4CellScorer::~G4CellScorer()
|
||||
{}
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4CellScorerStore.cc,v 1.4 2006-06-29 18:09:33 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
@@ -40,7 +39,15 @@
|
||||
|
||||
G4CellScorerStore::G4CellScorerStore() :
|
||||
fAutoCreate(false)
|
||||
{}
|
||||
{
|
||||
G4cout << "--------------------------------------------------------" << G4endl
|
||||
<< "WARNING: Class <G4CellScorerStore> is now obsolete |" << G4endl
|
||||
<< " and will be removed starting from next Geant4 |" << G4endl
|
||||
<< " major release. Please, consider switching to |" << G4endl
|
||||
<< " general purpose scoring functionality. |" << G4endl
|
||||
<< "--------------------------------------------------------"
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
G4CellScorerStore::~G4CellScorerStore()
|
||||
{}
|
||||
@@ -51,26 +58,26 @@ void G4CellScorerStore::SetAutoScorerCreate(){
|
||||
|
||||
G4CellScorer *G4CellScorerStore::
|
||||
AddCellScorer(G4VPhysicalVolume &vol, G4int repnum) {
|
||||
G4CellScorer *s = 0;
|
||||
s = new G4CellScorer;
|
||||
if (!s) {
|
||||
G4CellScorer *cs = 0;
|
||||
cs = new G4CellScorer;
|
||||
if (!cs) {
|
||||
G4Exception("G4CellScorerStore::AddCellScorer","Event0801",FatalException,
|
||||
"failed to create G4CellScorer!");
|
||||
}
|
||||
fMapGeometryCellCellScorer[G4GeometryCell(vol, repnum)] = s;
|
||||
return s;
|
||||
fMapGeometryCellCellScorer[G4GeometryCell(vol, repnum)] = cs;
|
||||
return cs;
|
||||
}
|
||||
|
||||
G4CellScorer *G4CellScorerStore::
|
||||
AddCellScorer(const G4GeometryCell &gCell) {
|
||||
G4CellScorer *s = 0;
|
||||
s = new G4CellScorer;
|
||||
if (!s) {
|
||||
G4CellScorer *cs = 0;
|
||||
cs = new G4CellScorer;
|
||||
if (!cs) {
|
||||
G4Exception("G4CellScorerStore::AddCellScorer","Event0801",FatalException,
|
||||
"failed to create G4CellScorer!");
|
||||
}
|
||||
fMapGeometryCellCellScorer[gCell] = s;
|
||||
return s;
|
||||
fMapGeometryCellCellScorer[gCell] = cs;
|
||||
return cs;
|
||||
}
|
||||
|
||||
const G4MapGeometryCellCellScorer &G4CellScorerStore::GetMapGeometryCellCellScorer() const {
|
||||
@@ -79,17 +86,17 @@ const G4MapGeometryCellCellScorer &G4CellScorerStore::GetMapGeometryCellCellScor
|
||||
|
||||
G4VCellScorer *G4CellScorerStore::
|
||||
GetCellScore(const G4GeometryCell &gCell){
|
||||
G4VCellScorer *s=0;
|
||||
G4VCellScorer *cs=0;
|
||||
G4MapGeometryCellCellScorer::iterator it = fMapGeometryCellCellScorer.find(gCell);
|
||||
if (it != fMapGeometryCellCellScorer.end()) {
|
||||
s = (*it).second;
|
||||
cs = (*it).second;
|
||||
}
|
||||
else {
|
||||
if (fAutoCreate) {
|
||||
s = AddCellScorer(gCell);
|
||||
cs = AddCellScorer(gCell);
|
||||
}
|
||||
}
|
||||
return s;
|
||||
return cs;
|
||||
}
|
||||
|
||||
void G4CellScorerStore::DeleteAllScorers(){
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4EvManMessenger.cc,v 1.6 2006-11-03 03:11:13 asaim Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4Event.cc,v 1.14 2007-03-07 02:44:16 asaim Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
|
||||
// G4Event
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4EventManager.cc,v 1.32 2010-11-08 21:31:35 asaim Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
//
|
||||
@@ -387,4 +386,10 @@ G4VUserEventInformation* G4EventManager::GetUserInformation()
|
||||
void G4EventManager::KeepTheCurrentEvent()
|
||||
{ if(currentEvent) currentEvent->KeepTheEvent(); }
|
||||
|
||||
void G4EventManager::AbortCurrentEvent()
|
||||
{
|
||||
abortRequested = true;
|
||||
trackContainer->clear();
|
||||
if(tracking) trackManager->EventAborted();
|
||||
}
|
||||
|
||||
|
||||
@@ -47,6 +47,11 @@
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
#include "G4GeneralParticleSourceMessenger.hh"
|
||||
|
||||
#include "G4PhysicalConstants.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4Geantino.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
@@ -62,7 +67,6 @@
|
||||
#include "G4ios.hh"
|
||||
|
||||
#include "G4Tokenizer.hh"
|
||||
#include "G4GeneralParticleSourceMessenger.hh"
|
||||
#include "G4SingleParticleSource.hh"
|
||||
#include "G4GeneralParticleSource.hh"
|
||||
|
||||
|
||||
@@ -24,16 +24,17 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4HEPEvtInterface.cc,v 1.11 2006-06-29 18:09:48 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4HEPEvtInterface.hh"
|
||||
|
||||
#include "G4Types.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
#include "G4ios.hh"
|
||||
#include "G4HEPEvtInterface.hh"
|
||||
#include "G4PrimaryVertex.hh"
|
||||
#include "G4PrimaryParticle.hh"
|
||||
#include "G4HEPEvtParticle.hh"
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4HEPEvtParticle.cc,v 1.8 2006-06-29 18:09:50 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -24,12 +24,12 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ParticleGun.cc,v 1.14 2007-11-07 17:13:19 asaim Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
|
||||
// G4ParticleGun
|
||||
#include "G4ParticleGun.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4PrimaryParticle.hh"
|
||||
#include "G4ParticleGunMessenger.hh"
|
||||
#include "G4Event.hh"
|
||||
|
||||
@@ -24,11 +24,11 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ParticleGunMessenger.cc,v 1.16 2007-10-02 00:45:17 asaim Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
|
||||
#include "G4ParticleGunMessenger.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4ParticleGun.hh"
|
||||
#include "G4Geantino.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
@@ -24,11 +24,11 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4PrimaryTransformer.cc,v 1.29 2010-08-09 14:38:18 kurasige Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
|
||||
#include "G4PrimaryTransformer.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4Event.hh"
|
||||
#include "G4PrimaryVertex.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
|
||||
@@ -24,11 +24,11 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4RayShooter.cc,v 1.2 2006-06-29 18:10:00 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
|
||||
#include "G4RayShooter.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4PrimaryParticle.hh"
|
||||
#include "G4Event.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
|
||||
@@ -45,9 +45,12 @@
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
#include "Randomize.hh"
|
||||
|
||||
#include "G4SPSAngDistribution.hh"
|
||||
|
||||
#include "Randomize.hh"
|
||||
#include "G4PhysicalConstants.hh"
|
||||
|
||||
G4SPSAngDistribution::G4SPSAngDistribution()
|
||||
: Theta(0.), Phi(0.)
|
||||
{
|
||||
|
||||
@@ -44,11 +44,12 @@
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
#include "Randomize.hh"
|
||||
//#include <cmath>
|
||||
|
||||
#include "G4SPSEneDistribution.hh"
|
||||
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "Randomize.hh"
|
||||
|
||||
G4SPSEneDistribution::G4SPSEneDistribution()
|
||||
: particle_definition(0), eneRndm(0), Splinetemp(0)
|
||||
{
|
||||
@@ -915,15 +916,15 @@ void G4SPSEneDistribution::GenerateBbodyEnergies() {
|
||||
}
|
||||
|
||||
// Now interpolate in that bin to find the correct output value.
|
||||
G4double x1, x2, y1, y2, m, q;
|
||||
G4double x1, x2, y1, y2, t, q;
|
||||
x1 = Bbody_x[nbelow];
|
||||
x2 = Bbody_x[nbelow + 1];
|
||||
y1 = BBHist[nbelow];
|
||||
y2 = BBHist[nbelow + 1];
|
||||
m = (y2 - y1) / (x2 - x1);
|
||||
q = y1 - m * x1;
|
||||
t = (y2 - y1) / (x2 - x1);
|
||||
q = y1 - t * x1;
|
||||
|
||||
particle_energy = (rndm - q) / m;
|
||||
particle_energy = (rndm - q) / t;
|
||||
|
||||
if (verbosityLevel >= 1) {
|
||||
G4cout << "Energy is " << particle_energy << G4endl;
|
||||
|
||||
@@ -44,13 +44,15 @@
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
#include "G4SPSPosDistribution.hh"
|
||||
|
||||
#include "G4PhysicalConstants.hh"
|
||||
#include "Randomize.hh"
|
||||
#include "G4TransportationManager.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4PhysicalVolumeStore.hh"
|
||||
|
||||
#include "G4SPSPosDistribution.hh"
|
||||
|
||||
G4SPSPosDistribution::G4SPSPosDistribution()
|
||||
: posRndm(0)
|
||||
{
|
||||
@@ -142,20 +144,20 @@ void G4SPSPosDistribution::SetHalfZ(G4double zhalf)
|
||||
halfz = zhalf;
|
||||
}
|
||||
|
||||
void G4SPSPosDistribution::SetRadius(G4double rad)
|
||||
void G4SPSPosDistribution::SetRadius(G4double rds)
|
||||
{
|
||||
Radius = rad;
|
||||
Radius = rds;
|
||||
}
|
||||
|
||||
void G4SPSPosDistribution::SetRadius0(G4double rad)
|
||||
void G4SPSPosDistribution::SetRadius0(G4double rds)
|
||||
{
|
||||
Radius0 = rad;
|
||||
Radius0 = rds;
|
||||
}
|
||||
|
||||
void G4SPSPosDistribution::SetBeamSigmaInR(G4double r)
|
||||
{
|
||||
SX = SY = r;
|
||||
SR = r;
|
||||
SX = SY = r/std::sqrt(2.);
|
||||
}
|
||||
|
||||
void G4SPSPosDistribution::SetBeamSigmaInX(G4double r)
|
||||
@@ -192,7 +194,9 @@ void G4SPSPosDistribution::GenerateRotationMatrices()
|
||||
Rotx = Rotx.unit(); // x'
|
||||
Roty = Roty.unit(); // vector in x'y' plane
|
||||
Rotz = Rotx.cross(Roty); // z'
|
||||
Rotz = Rotz.unit();
|
||||
Roty = Rotz.cross(Rotx); // y'
|
||||
Roty = Roty.unit();
|
||||
if(verbosityLevel == 2)
|
||||
{
|
||||
G4cout << "The new axes, x', y', z' " << Rotx << " " << Roty << " " << Rotz << G4endl;
|
||||
@@ -464,7 +468,7 @@ void G4SPSPosDistribution::GeneratePointsOnSurface()
|
||||
}
|
||||
else if(Shape == "Ellipsoid")
|
||||
{
|
||||
G4double theta, phi, minphi, maxphi, middlephi;
|
||||
G4double minphi, maxphi, middlephi;
|
||||
G4double answer, constant;
|
||||
|
||||
constant = pi/(halfx*halfx) + pi/(halfy*halfy) +
|
||||
|
||||
@@ -44,10 +44,14 @@
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
#include <cmath>
|
||||
|
||||
#include "G4SingleParticleSource.hh"
|
||||
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4PrimaryParticle.hh"
|
||||
#include "G4Event.hh"
|
||||
#include "Randomize.hh"
|
||||
#include <cmath>
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4Geantino.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
@@ -55,7 +59,6 @@
|
||||
#include "G4Ions.hh"
|
||||
#include "G4TrackingManager.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4SingleParticleSource.hh"
|
||||
|
||||
G4SingleParticleSource::G4SingleParticleSource() {
|
||||
// Initialise all variables
|
||||
|
||||
@@ -24,116 +24,137 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4SmartTrackStack.cc,v 1.5 2010-11-24 22:56:57 asaim Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
|
||||
#include "G4SmartTrackStack.hh"
|
||||
#include "G4VTrajectory.hh"
|
||||
#include "G4Track.hh"
|
||||
|
||||
void G4SmartTrackStack::dumpStatistics()
|
||||
{
|
||||
// Print to stderr so that we can split stats output from normal
|
||||
// output of Geant4 which is typically being printed to stdout
|
||||
for (int i = 0; i < nTurn; i++) {
|
||||
G4cerr << stacks[i]->GetNTrack() << " ";
|
||||
G4cerr << stacks[i]->getTotalEnergy() << " ";
|
||||
}
|
||||
G4cerr << G4endl;
|
||||
}
|
||||
|
||||
G4SmartTrackStack::G4SmartTrackStack()
|
||||
:fTurn(0),nTurn(5)
|
||||
:fTurn(0), nTurn(5), maxNTracks(0), nTracks(0)
|
||||
{
|
||||
for(int i=0;i<nTurn;i++)
|
||||
{ stacks[i] = new G4TrackStack(); }
|
||||
// If entry of one sub-stack exceeds safetyValve1, we will stick
|
||||
// to that sub-stack until entry of that sub-stack goes down
|
||||
// to safetyValve2.
|
||||
nStick = 100;
|
||||
safetyValve1 = 3000;
|
||||
safetyValve2 = safetyValve1 - nStick;
|
||||
maxNTracks = 0;
|
||||
for(int i=0;i<nTurn;i++)
|
||||
{
|
||||
stacks[i] = new G4TrackStack(5000);
|
||||
energies[i] = 0.;
|
||||
}
|
||||
}
|
||||
|
||||
G4SmartTrackStack::~G4SmartTrackStack()
|
||||
{
|
||||
for(int i=0;i<nTurn;i++)
|
||||
{ delete stacks[i]; }
|
||||
for (int i = 0; i < nTurn; i++) {
|
||||
delete stacks[i];
|
||||
}
|
||||
}
|
||||
|
||||
const G4SmartTrackStack & G4SmartTrackStack::operator=(const G4SmartTrackStack &)
|
||||
{ return *this; }
|
||||
int G4SmartTrackStack::operator==(const G4SmartTrackStack &right) const
|
||||
{ return (this==&right); }
|
||||
int G4SmartTrackStack::operator!=(const G4SmartTrackStack &right) const
|
||||
{ return (this!=&right); }
|
||||
|
||||
void G4SmartTrackStack::TransferTo(G4TrackStack * aStack)
|
||||
{
|
||||
for(int i=0;i<nTurn;i++)
|
||||
{ stacks[i]->TransferTo(aStack); }
|
||||
const G4SmartTrackStack &
|
||||
G4SmartTrackStack::operator=(const G4SmartTrackStack &) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
G4StackedTrack * G4SmartTrackStack::PopFromStack()
|
||||
{
|
||||
if( n_stackedTrack() == 0 ) return 0;
|
||||
G4StackedTrack * aStackedTrack = 0;
|
||||
while(!aStackedTrack)
|
||||
{
|
||||
if(stacks[fTurn]->GetNTrack()==0)
|
||||
{
|
||||
fTurn = (fTurn+1)%nTurn;
|
||||
//G4cout<<"++++++++ Shift to Stack ["<<fTurn<<"] with "<<stacks[fTurn]->GetNTrack()<<" stacked tracks."<<G4endl;
|
||||
}
|
||||
else
|
||||
{ aStackedTrack = stacks[fTurn]->PopFromStack(); }
|
||||
}
|
||||
return aStackedTrack;
|
||||
int G4SmartTrackStack::operator==(const G4SmartTrackStack &right) const {
|
||||
return (this==&right);
|
||||
}
|
||||
|
||||
#include "G4Neutron.hh"
|
||||
#include "G4Gamma.hh"
|
||||
#include "G4Electron.hh"
|
||||
#include "G4Positron.hh"
|
||||
int G4SmartTrackStack::operator!=(const G4SmartTrackStack &right) const {
|
||||
return (this!=&right);
|
||||
}
|
||||
|
||||
void G4SmartTrackStack::PushToStack( G4StackedTrack * aStackedTrack )
|
||||
void G4SmartTrackStack::TransferTo(G4TrackStack* aStack)
|
||||
{
|
||||
static G4ParticleDefinition* neutDef = G4Neutron::Definition();
|
||||
static G4ParticleDefinition* elecDef = G4Electron::Definition();
|
||||
static G4ParticleDefinition* gammDef = G4Gamma::Definition();
|
||||
static G4ParticleDefinition* posiDef = G4Positron::Definition();
|
||||
for (int i = 0; i < nTurn; i++) {
|
||||
stacks[i]->TransferTo(aStack);
|
||||
}
|
||||
nTracks = 0;
|
||||
}
|
||||
|
||||
if(!aStackedTrack) return;
|
||||
G4StackedTrack G4SmartTrackStack::PopFromStack()
|
||||
{
|
||||
G4StackedTrack aStackedTrack;
|
||||
|
||||
if (nTracks) {
|
||||
while (true) {
|
||||
if (stacks[fTurn]->GetNTrack()) {
|
||||
aStackedTrack = stacks[fTurn]->PopFromStack();
|
||||
energies[fTurn] -= aStackedTrack.GetTrack()->GetDynamicParticle()->GetTotalEnergy();
|
||||
nTracks--;
|
||||
break;
|
||||
} else {
|
||||
fTurn = (fTurn+1) % nTurn;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// dumpStatistics();
|
||||
return aStackedTrack;
|
||||
}
|
||||
|
||||
enum {
|
||||
electronCode = 11, positronCode = -11, gammaCode = 22, neutronCode = 2112
|
||||
};
|
||||
|
||||
void G4SmartTrackStack::PushToStack( const G4StackedTrack& aStackedTrack )
|
||||
{
|
||||
|
||||
G4int iDest = 0;
|
||||
if( aStackedTrack->GetTrack()->GetParentID() == 0 )
|
||||
{
|
||||
if (aStackedTrack.GetTrack()->GetParentID()) {
|
||||
G4int code = aStackedTrack.GetTrack()->GetDynamicParticle()->GetPDGcode();
|
||||
if (code == electronCode)
|
||||
iDest = 2;
|
||||
else if (code == gammaCode)
|
||||
iDest = 3;
|
||||
else if (code == positronCode)
|
||||
iDest = 4;
|
||||
else if (code == neutronCode)
|
||||
iDest = 1;
|
||||
} else {
|
||||
// We have a primary track, which should go first.
|
||||
fTurn = 0; // reseting the turn
|
||||
}
|
||||
else
|
||||
{
|
||||
G4ParticleDefinition* partDef = aStackedTrack->GetTrack()->GetDefinition();
|
||||
if(partDef==neutDef)
|
||||
{ iDest = 1; }
|
||||
else if(partDef==elecDef)
|
||||
{ iDest = 2; }
|
||||
else if(partDef==gammDef)
|
||||
{ iDest = 3; }
|
||||
else if(partDef==posiDef)
|
||||
{ iDest = 4; }
|
||||
}
|
||||
|
||||
stacks[iDest]->PushToStack(aStackedTrack);
|
||||
if(stacks[iDest]->GetNTrack()>safetyValve1)
|
||||
{
|
||||
// Too many tracks in the stack. Process tracks in this stack first
|
||||
// unless the current stack also have too many tracks.
|
||||
if(stacks[fTurn]->GetNTrack()<safetyValve2)
|
||||
{
|
||||
fTurn = iDest;
|
||||
safetyValve2 = stacks[iDest]->GetNTrack() - nStick;
|
||||
//G4cout<<"++++++++ Shift to Stack ["<<fTurn<<"] with "<<stacks[fTurn]->GetNTrack()<<" stacked tracks."<<G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
if(n_stackedTrack()>maxNTracks) maxNTracks = n_stackedTrack();
|
||||
energies[iDest] += aStackedTrack.GetTrack()->GetDynamicParticle()->GetTotalEnergy();
|
||||
nTracks++;
|
||||
|
||||
G4int dy1 = stacks[iDest]->GetNTrack() - stacks[iDest]->GetSafetyValve1();
|
||||
G4int dy2 = stacks[fTurn]->GetNTrack() - stacks[fTurn]->GetSafetyValve2();
|
||||
|
||||
if (dy1 > 0 || dy1 > dy2 ||
|
||||
(iDest == 2 &&
|
||||
stacks[iDest]->GetNTrack() < 50 && energies[iDest] < energies[fTurn])) {
|
||||
fTurn = iDest;
|
||||
}
|
||||
|
||||
if (nTracks > maxNTracks) maxNTracks = nTracks;
|
||||
}
|
||||
|
||||
void G4SmartTrackStack::clear()
|
||||
{
|
||||
for(int i=0;i<nTurn;i++)
|
||||
{ stacks[i]->clear(); }
|
||||
for (int i = 0; i < nTurn; i++) {
|
||||
stacks[i]->clear();
|
||||
energies[i] = 0.0;
|
||||
fTurn = 0;
|
||||
}
|
||||
nTracks = 0;
|
||||
}
|
||||
|
||||
|
||||
void G4SmartTrackStack::clearAndDestroy()
|
||||
{
|
||||
for (int i = 0; i < nTurn; i++) {
|
||||
stacks[i]->clearAndDestroy();
|
||||
energies[i] = 0.0;
|
||||
fTurn = 0;
|
||||
}
|
||||
nTracks = 0;
|
||||
}
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4StackChecker.cc,v 1.2 2006-06-29 18:10:17 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
|
||||
#include "G4StackChecker.hh"
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4StackManager.cc,v 1.15 2010-12-15 22:15:07 asaim Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Last Modification : 09/Dec/96 M.Asai
|
||||
@@ -43,13 +42,13 @@ G4StackManager::G4StackManager()
|
||||
theMessenger = new G4StackingMessenger(this);
|
||||
#ifdef G4_USESMARTSTACK
|
||||
urgentStack = new G4SmartTrackStack;
|
||||
G4cout<<"+++ G4StackManager uses G4SmartTrackStack. +++"<<G4endl;
|
||||
// G4cout<<"+++ G4StackManager uses G4SmartTrackStack. +++"<<G4endl;
|
||||
#else
|
||||
urgentStack = new G4TrackStack;
|
||||
urgentStack = new G4TrackStack(5000);
|
||||
// G4cout<<"+++ G4StackManager uses ordinary G4TrackStack. +++"<<G4endl;
|
||||
#endif
|
||||
waitingStack = new G4TrackStack;
|
||||
postponeStack = new G4TrackStack;
|
||||
waitingStack = new G4TrackStack(1000);
|
||||
postponeStack = new G4TrackStack(1000);
|
||||
}
|
||||
|
||||
G4StackManager::~G4StackManager()
|
||||
@@ -103,7 +102,7 @@ G4int G4StackManager::PushOneTrack(G4Track *newTrack,G4VTrajectory *newTrajector
|
||||
}
|
||||
else
|
||||
{
|
||||
G4StackedTrack * newStackedTrack = new G4StackedTrack( newTrack, newTrajectory );
|
||||
G4StackedTrack newStackedTrack( newTrack, newTrajectory );
|
||||
switch (classification)
|
||||
{
|
||||
case fUrgent:
|
||||
@@ -168,44 +167,43 @@ G4Track * G4StackManager::PopNextTrack(G4VTrajectory**newTrajectory)
|
||||
if( ( GetNUrgentTrack()==0 ) && ( GetNWaitingTrack()==0 ) ) return 0;
|
||||
}
|
||||
|
||||
G4StackedTrack * selectedStackedTrack = urgentStack->PopFromStack();
|
||||
G4Track * selectedTrack = selectedStackedTrack->GetTrack();
|
||||
*newTrajectory = selectedStackedTrack->GetTrajectory();
|
||||
G4StackedTrack selectedStackedTrack = urgentStack->PopFromStack();
|
||||
G4Track * selectedTrack = selectedStackedTrack.GetTrack();
|
||||
*newTrajectory = selectedStackedTrack.GetTrajectory();
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if( verboseLevel > 2 )
|
||||
{
|
||||
G4cout << "Selected G4StackedTrack : " << selectedStackedTrack
|
||||
<< " with G4Track " << selectedStackedTrack->GetTrack()
|
||||
<< " (trackID " << selectedStackedTrack->GetTrack()->GetTrackID()
|
||||
<< ", parentID " << selectedStackedTrack->GetTrack()->GetParentID()
|
||||
<< ")" << G4endl;
|
||||
G4cout << "Selected G4StackedTrack : " << &selectedStackedTrack
|
||||
<< " with G4Track " << selectedStackedTrack.GetTrack()
|
||||
<< " (trackID " << selectedStackedTrack.GetTrack()->GetTrackID()
|
||||
<< ", parentID " << selectedStackedTrack.GetTrack()->GetParentID()
|
||||
<< ")" << G4endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
delete selectedStackedTrack;
|
||||
return selectedTrack;
|
||||
}
|
||||
|
||||
void G4StackManager::ReClassify()
|
||||
{
|
||||
G4StackedTrack * aStackedTrack;
|
||||
G4StackedTrack aStackedTrack;
|
||||
G4TrackStack tmpStack;
|
||||
|
||||
|
||||
if( !userStackingAction ) return;
|
||||
if( GetNUrgentTrack() == 0 ) return;
|
||||
|
||||
|
||||
urgentStack->TransferTo(&tmpStack);
|
||||
while( (aStackedTrack=tmpStack.PopFromStack()) != 0 )
|
||||
while( tmpStack.GetNTrack() > 0 )
|
||||
{
|
||||
G4ClassificationOfNewTrack classification =
|
||||
userStackingAction->ClassifyNewTrack( aStackedTrack->GetTrack() );
|
||||
aStackedTrack=tmpStack.PopFromStack();
|
||||
G4ClassificationOfNewTrack classification =
|
||||
userStackingAction->ClassifyNewTrack( aStackedTrack.GetTrack() );
|
||||
switch (classification)
|
||||
{
|
||||
case fKill:
|
||||
delete aStackedTrack->GetTrack();
|
||||
delete aStackedTrack->GetTrajectory();
|
||||
delete aStackedTrack;
|
||||
delete aStackedTrack.GetTrack();
|
||||
delete aStackedTrack.GetTrajectory();
|
||||
break;
|
||||
case fUrgent:
|
||||
urgentStack->PushToStack( aStackedTrack );
|
||||
@@ -222,7 +220,7 @@ void G4StackManager::ReClassify()
|
||||
G4ExceptionDescription ED;
|
||||
ED << "invalid classification " << classification << G4endl;
|
||||
G4Exception("G4StackManager::ReClassify","Event0052",
|
||||
FatalException,ED);
|
||||
FatalException,ED);
|
||||
} else {
|
||||
additionalWaitingStacks[i-1]->PushToStack( aStackedTrack );
|
||||
}
|
||||
@@ -234,39 +232,41 @@ void G4StackManager::ReClassify()
|
||||
G4int G4StackManager::PrepareNewEvent()
|
||||
{
|
||||
if(userStackingAction) userStackingAction->PrepareNewEvent();
|
||||
|
||||
|
||||
urgentStack->clearAndDestroy(); // Set the urgentStack in a defined state. Not doing it would affect reproducibility.
|
||||
|
||||
G4int n_passedFromPrevious = 0;
|
||||
|
||||
|
||||
if( GetNPostponedTrack() > 0 )
|
||||
{
|
||||
#ifdef G4VERBOSE
|
||||
if( verboseLevel > 1 )
|
||||
{
|
||||
G4cout << GetNPostponedTrack()
|
||||
<< " postponed tracked are now shifted to the stack." << G4endl;
|
||||
G4cout << GetNPostponedTrack()
|
||||
<< " postponed tracked are now shifted to the stack." << G4endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
G4StackedTrack * aStackedTrack;
|
||||
G4TrackStack tmpStack;
|
||||
|
||||
|
||||
G4StackedTrack aStackedTrack;
|
||||
G4TrackStack tmpStack;
|
||||
|
||||
postponeStack->TransferTo(&tmpStack);
|
||||
|
||||
while( (aStackedTrack=tmpStack.PopFromStack()) != 0 )
|
||||
|
||||
while( tmpStack.GetNTrack() > 0 )
|
||||
{
|
||||
G4Track* aTrack = aStackedTrack->GetTrack();
|
||||
aStackedTrack=tmpStack.PopFromStack();
|
||||
G4Track* aTrack = aStackedTrack.GetTrack();
|
||||
aTrack->SetParentID(-1);
|
||||
G4ClassificationOfNewTrack classification;
|
||||
if(userStackingAction)
|
||||
if(userStackingAction)
|
||||
{ classification = userStackingAction->ClassifyNewTrack( aTrack ); }
|
||||
else
|
||||
{ classification = DefaultClassification( aTrack ); }
|
||||
|
||||
|
||||
if(classification==fKill)
|
||||
{
|
||||
delete aTrack;
|
||||
delete aStackedTrack->GetTrajectory();
|
||||
delete aStackedTrack;
|
||||
delete aStackedTrack.GetTrajectory();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -288,7 +288,7 @@ G4int G4StackManager::PrepareNewEvent()
|
||||
G4ExceptionDescription ED;
|
||||
ED << "invalid classification " << classification << G4endl;
|
||||
G4Exception("G4StackManager::PrepareNewEvent","Event0053",
|
||||
FatalException,ED);
|
||||
FatalException,ED);
|
||||
} else {
|
||||
additionalWaitingStacks[i-1]->PushToStack( aStackedTrack );
|
||||
}
|
||||
@@ -297,7 +297,7 @@ G4int G4StackManager::PrepareNewEvent()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return n_passedFromPrevious;
|
||||
}
|
||||
|
||||
@@ -342,14 +342,14 @@ void G4StackManager::TransferStackedTracks(G4ClassificationOfNewTrack origin, G4
|
||||
if(i<=numberOfAdditionalWaitingStacks) originStack = additionalWaitingStacks[i-1];
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if(destination==fKill)
|
||||
{
|
||||
if(originStack)
|
||||
{ originStack->clear(); }
|
||||
{ originStack->clearAndDestroy(); }
|
||||
else
|
||||
{ urgentStack->clear(); }
|
||||
}
|
||||
{ urgentStack->clearAndDestroy(); }
|
||||
}
|
||||
else
|
||||
{
|
||||
G4TrackStack* targetStack = 0;
|
||||
@@ -403,21 +403,21 @@ void G4StackManager::TransferOneStackedTrack(G4ClassificationOfNewTrack origin,
|
||||
if(i<=numberOfAdditionalWaitingStacks) originStack = additionalWaitingStacks[i-1];
|
||||
break;
|
||||
}
|
||||
|
||||
G4StackedTrack * aStackedTrack = 0;
|
||||
|
||||
G4StackedTrack aStackedTrack;
|
||||
if(destination==fKill)
|
||||
{
|
||||
if(originStack)
|
||||
{ aStackedTrack = originStack->PopFromStack(); }
|
||||
else
|
||||
{ aStackedTrack = urgentStack->PopFromStack(); }
|
||||
if(aStackedTrack)
|
||||
{
|
||||
delete aStackedTrack->GetTrack();
|
||||
delete aStackedTrack->GetTrajectory();
|
||||
delete aStackedTrack;
|
||||
if( originStack && originStack->GetNTrack() ) {
|
||||
aStackedTrack = originStack->PopFromStack();
|
||||
delete aStackedTrack.GetTrack();
|
||||
delete aStackedTrack.GetTrajectory();
|
||||
}
|
||||
}
|
||||
else if (urgentStack->GetNTrack() ) {
|
||||
aStackedTrack = urgentStack->PopFromStack();
|
||||
delete aStackedTrack.GetTrack();
|
||||
delete aStackedTrack.GetTrajectory();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
G4TrackStack* targetStack = 0;
|
||||
@@ -437,19 +437,91 @@ void G4StackManager::TransferOneStackedTrack(G4ClassificationOfNewTrack origin,
|
||||
if(i<=numberOfAdditionalWaitingStacks) targetStack = additionalWaitingStacks[i-1];
|
||||
break;
|
||||
}
|
||||
if(originStack)
|
||||
{ aStackedTrack = originStack->PopFromStack(); }
|
||||
else
|
||||
{ aStackedTrack = urgentStack->PopFromStack(); }
|
||||
if(targetStack)
|
||||
{ targetStack->PushToStack(aStackedTrack); }
|
||||
else
|
||||
{ urgentStack->PushToStack(aStackedTrack); }
|
||||
if(originStack && originStack->GetNTrack()) {
|
||||
aStackedTrack = originStack->PopFromStack();
|
||||
if(targetStack) { targetStack->PushToStack(aStackedTrack); }
|
||||
else { urgentStack->PushToStack(aStackedTrack); }
|
||||
}
|
||||
else if(urgentStack->GetNTrack()) {
|
||||
aStackedTrack = urgentStack->PopFromStack();
|
||||
if(targetStack) { targetStack->PushToStack(aStackedTrack); }
|
||||
else { urgentStack->PushToStack(aStackedTrack); }
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void G4StackManager::clear()
|
||||
{
|
||||
ClearUrgentStack();
|
||||
ClearWaitingStack();
|
||||
for(int i=1;i<=numberOfAdditionalWaitingStacks;i++) {ClearWaitingStack(i);}
|
||||
}
|
||||
|
||||
void G4StackManager::ClearUrgentStack()
|
||||
{
|
||||
urgentStack->clearAndDestroy();
|
||||
}
|
||||
|
||||
void G4StackManager::ClearWaitingStack(int i)
|
||||
{
|
||||
if(i==0) {
|
||||
waitingStack->clearAndDestroy();
|
||||
} else {
|
||||
if(i<=numberOfAdditionalWaitingStacks) additionalWaitingStacks[i-1]->clearAndDestroy();
|
||||
}
|
||||
}
|
||||
|
||||
void G4StackManager::ClearPostponeStack()
|
||||
{
|
||||
postponeStack->clearAndDestroy();
|
||||
}
|
||||
|
||||
G4int G4StackManager::GetNTotalTrack() const
|
||||
{
|
||||
int n = urgentStack->GetNTrack() + waitingStack->GetNTrack() + postponeStack->GetNTrack();
|
||||
for(int i=1;i<=numberOfAdditionalWaitingStacks;i++) {n += additionalWaitingStacks[i-1]->GetNTrack();}
|
||||
return n;
|
||||
}
|
||||
|
||||
G4int G4StackManager::GetNUrgentTrack() const
|
||||
{
|
||||
return urgentStack->GetNTrack();
|
||||
}
|
||||
|
||||
G4int G4StackManager::GetNWaitingTrack(int i) const
|
||||
{
|
||||
if(i==0) { return waitingStack->GetNTrack(); }
|
||||
else {
|
||||
if(i<=numberOfAdditionalWaitingStacks) { return additionalWaitingStacks[i-1]->GetNTrack();}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
G4int G4StackManager::GetNPostponedTrack() const
|
||||
{
|
||||
return postponeStack->GetNTrack();
|
||||
}
|
||||
|
||||
void G4StackManager::SetVerboseLevel( G4int const value )
|
||||
{
|
||||
verboseLevel = value;
|
||||
}
|
||||
|
||||
void G4StackManager::SetUserStackingAction(G4UserStackingAction* value)
|
||||
{
|
||||
userStackingAction = value;
|
||||
if(userStackingAction) userStackingAction->SetStackManager(this);
|
||||
}
|
||||
|
||||
G4ClassificationOfNewTrack G4StackManager::DefaultClassification(G4Track *aTrack)
|
||||
{
|
||||
G4ClassificationOfNewTrack classification = fUrgent;
|
||||
if( aTrack->GetTrackStatus() == fPostponeToNextEvent )
|
||||
{ classification = fPostpone; }
|
||||
return classification;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4StackedTrack.cc,v 1.9 2006-06-29 18:10:21 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
//
|
||||
//
|
||||
// Last Modification : 02/Feb/96 M.Asai
|
||||
//
|
||||
|
||||
#include "G4StackedTrack.hh"
|
||||
|
||||
G4Allocator<G4StackedTrack> aStackedTrackAllocator;
|
||||
|
||||
G4StackedTrack::G4StackedTrack()
|
||||
:priorityWeight(0.),track(0),trajectory(0),
|
||||
previousStackedTrack(0),nextStackedTrack(0)
|
||||
{ }
|
||||
|
||||
G4StackedTrack::G4StackedTrack(G4Track * newTrack, G4VTrajectory * aTrajectory)
|
||||
:priorityWeight(0.),track(newTrack),trajectory(aTrajectory),
|
||||
previousStackedTrack(0),nextStackedTrack(0)
|
||||
{ }
|
||||
|
||||
G4StackedTrack::~G4StackedTrack()
|
||||
{ }
|
||||
|
||||
G4StackedTrack& G4StackedTrack::operator=(const G4StackedTrack &)
|
||||
{ return *this; }
|
||||
G4int G4StackedTrack::operator==(const G4StackedTrack &right) const
|
||||
{ return (this==&right); }
|
||||
G4int G4StackedTrack::operator!=(const G4StackedTrack &right) const
|
||||
{ return (this!=&right); }
|
||||
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4StackingMessenger.cc,v 1.6 2009-09-16 23:10:46 asaim Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -24,159 +24,45 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4TrackStack.cc,v 1.9 2010-11-24 22:56:57 asaim Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
|
||||
#include "G4TrackStack.hh"
|
||||
#include "G4SmartTrackStack.hh"
|
||||
#include "G4VTrajectory.hh"
|
||||
|
||||
G4TrackStack::G4TrackStack()
|
||||
:n_stackedTrack(0),firstStackedTrack(0),lastStackedTrack(0)
|
||||
{
|
||||
maxNTracks = 0;
|
||||
}
|
||||
#include "G4Track.hh"
|
||||
|
||||
G4TrackStack::~G4TrackStack()
|
||||
{
|
||||
if( n_stackedTrack != 0 )
|
||||
{
|
||||
G4StackedTrack * aStackedTrack = firstStackedTrack;
|
||||
G4StackedTrack * nextStackedTrack;
|
||||
|
||||
// delete tracks in the stack
|
||||
while( aStackedTrack != 0 )
|
||||
{
|
||||
nextStackedTrack = aStackedTrack->GetNext();
|
||||
delete aStackedTrack->GetTrack();
|
||||
delete aStackedTrack->GetTrajectory();
|
||||
delete aStackedTrack;
|
||||
aStackedTrack = nextStackedTrack;
|
||||
}
|
||||
}
|
||||
clearAndDestroy();
|
||||
}
|
||||
|
||||
const G4TrackStack & G4TrackStack::operator=(const G4TrackStack &right)
|
||||
void G4TrackStack::clearAndDestroy()
|
||||
{
|
||||
n_stackedTrack = right.n_stackedTrack;
|
||||
firstStackedTrack = right.firstStackedTrack;
|
||||
lastStackedTrack = right.lastStackedTrack;
|
||||
return *this;
|
||||
for( iterator i = begin(); i != end(); i++ ) {
|
||||
delete (*i).GetTrack();
|
||||
delete (*i).GetTrajectory();
|
||||
}
|
||||
clear();
|
||||
}
|
||||
|
||||
int G4TrackStack::operator==(const G4TrackStack &right) const
|
||||
{ return (firstStackedTrack==right.firstStackedTrack); }
|
||||
int G4TrackStack::operator!=(const G4TrackStack &right) const
|
||||
{ return (firstStackedTrack!=right.firstStackedTrack); }
|
||||
|
||||
void G4TrackStack::TransferTo(G4TrackStack * aStack)
|
||||
{
|
||||
if(n_stackedTrack==0) return;
|
||||
|
||||
if(aStack->n_stackedTrack == 0)
|
||||
{
|
||||
*aStack = *this;
|
||||
}
|
||||
else
|
||||
{
|
||||
aStack->lastStackedTrack->SetNext( firstStackedTrack );
|
||||
firstStackedTrack->SetPrevious( aStack->lastStackedTrack );
|
||||
aStack->lastStackedTrack = lastStackedTrack;
|
||||
aStack->n_stackedTrack += n_stackedTrack;
|
||||
}
|
||||
|
||||
n_stackedTrack = 0;
|
||||
firstStackedTrack = 0;
|
||||
lastStackedTrack = 0;
|
||||
void G4TrackStack::TransferTo(G4TrackStack* aStack) {
|
||||
for(iterator i = begin(); i != end(); i++) aStack->push_back(*i);
|
||||
clear();
|
||||
}
|
||||
|
||||
|
||||
void G4TrackStack::TransferTo(G4SmartTrackStack * aStack)
|
||||
{
|
||||
while(n_stackedTrack)
|
||||
{ aStack->PushToStack(PopFromStack()); }
|
||||
while(size()) { aStack->PushToStack(PopFromStack()); }
|
||||
}
|
||||
|
||||
G4StackedTrack * G4TrackStack::PopFromStack()
|
||||
|
||||
G4double G4TrackStack::getTotalEnergy(void) const
|
||||
{
|
||||
if( n_stackedTrack == 0 ) return 0;
|
||||
G4StackedTrack * aStackedTrack = lastStackedTrack;
|
||||
GrabFromStack( aStackedTrack );
|
||||
return aStackedTrack;
|
||||
G4double totalEnergy = 0.0;
|
||||
for (const_iterator i = begin(); i != end(); i++) {
|
||||
totalEnergy += (*i).GetTrack()->GetDynamicParticle()->GetTotalEnergy();
|
||||
}
|
||||
return totalEnergy;
|
||||
}
|
||||
|
||||
void G4TrackStack::PushToStack( G4StackedTrack * aStackedTrack )
|
||||
{
|
||||
if(aStackedTrack)
|
||||
{
|
||||
if( n_stackedTrack == 0 )
|
||||
{
|
||||
aStackedTrack->SetPrevious( 0 );
|
||||
firstStackedTrack = aStackedTrack;
|
||||
}
|
||||
else
|
||||
{
|
||||
lastStackedTrack->SetNext( aStackedTrack );
|
||||
aStackedTrack->SetPrevious( lastStackedTrack );
|
||||
}
|
||||
lastStackedTrack = aStackedTrack;
|
||||
n_stackedTrack++;
|
||||
if(n_stackedTrack>maxNTracks) maxNTracks = n_stackedTrack;
|
||||
}
|
||||
}
|
||||
|
||||
void G4TrackStack::GrabFromStack( G4StackedTrack * aStackedTrack )
|
||||
{
|
||||
if( n_stackedTrack == 1 )
|
||||
{
|
||||
firstStackedTrack = 0;
|
||||
lastStackedTrack = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( aStackedTrack == firstStackedTrack )
|
||||
{
|
||||
firstStackedTrack = aStackedTrack->GetNext();
|
||||
firstStackedTrack->SetPrevious( 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( aStackedTrack == lastStackedTrack )
|
||||
{
|
||||
lastStackedTrack = aStackedTrack->GetPrevious();
|
||||
lastStackedTrack->SetNext( 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
aStackedTrack->GetPrevious()
|
||||
->SetNext( aStackedTrack->GetNext() );
|
||||
aStackedTrack->GetNext()
|
||||
->SetPrevious( aStackedTrack->GetPrevious() );
|
||||
}
|
||||
}
|
||||
}
|
||||
n_stackedTrack--;
|
||||
}
|
||||
|
||||
void G4TrackStack::clear()
|
||||
{
|
||||
G4StackedTrack * aStackedTrack = firstStackedTrack;
|
||||
G4StackedTrack * nextStackedTrack;
|
||||
|
||||
if ( n_stackedTrack == 0 ) return;
|
||||
|
||||
// delete tracks in the stack
|
||||
while( aStackedTrack != 0 )
|
||||
{
|
||||
nextStackedTrack = aStackedTrack->GetNext();
|
||||
delete aStackedTrack->GetTrack();
|
||||
delete aStackedTrack->GetTrajectory();
|
||||
delete aStackedTrack;
|
||||
aStackedTrack = nextStackedTrack;
|
||||
}
|
||||
n_stackedTrack = 0;
|
||||
firstStackedTrack = 0;
|
||||
lastStackedTrack = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4TrajectoryContainer.cc,v 1.5 2006-06-29 18:10:28 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
|
||||
#include "G4TrajectoryContainer.hh"
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4UserEventAction.cc,v 1.7 2006-06-29 18:10:31 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
|
||||
#include "G4UserEventAction.hh"
|
||||
@@ -34,10 +33,9 @@
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
|
||||
void G4UserEventAction::BeginOfEventAction(const G4Event*)
|
||||
G4UserEventAction::G4UserEventAction()
|
||||
{
|
||||
if(!(G4ParticleTable::GetParticleTable()->GetReadiness()))
|
||||
if(!(G4ParticleTable::GetParticleTable()->GetReadiness()))
|
||||
{
|
||||
G4String msg;
|
||||
msg = " You are instantiating G4UserEventAction BEFORE your\n";
|
||||
@@ -51,6 +49,11 @@ void G4UserEventAction::BeginOfEventAction(const G4Event*)
|
||||
}
|
||||
}
|
||||
|
||||
G4UserEventAction::~G4UserEventAction()
|
||||
{;}
|
||||
|
||||
void G4UserEventAction::BeginOfEventAction(const G4Event*)
|
||||
{;}
|
||||
|
||||
void G4UserEventAction::EndOfEventAction(const G4Event*)
|
||||
{;}
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4UserStackingAction.cc,v 1.7 2006-06-29 18:10:33 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
|
||||
#include "G4UserStackingAction.hh"
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VPrimaryGenerator.cc,v 1.5 2006-06-29 18:10:35 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
|
||||
// G4VPrimaryGenerator
|
||||
|
||||
Reference in New Issue
Block a user