Import Geant4 0.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 15:09:25 +02:00
parent b97f8d0df7
commit aaa409b6ee
2922 changed files with 55107 additions and 81674 deletions
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4LightMedia.cc,v 2.3 1998/08/24 12:05:12 hpw Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4LightMedia.cc,v 1.1 1999/01/07 16:13:50 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// Hadronic Process: Light Media Charge and/or Strangeness Exchange
// J.L. Chuma, TRIUMF, 21-Feb-1997
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4Nucleus.cc,v 2.6 1998/10/05 09:12:40 pia Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4Nucleus.cc,v 1.3 1999/03/29 09:48:41 hpw Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// original by H.P. Wellisch
// modified by J.L. Chuma, TRIUMF, 19-Nov-1996
@@ -54,10 +54,16 @@
G4double random = G4UniformRand();
G4double sum = 0;
const G4ElementVector *theElementVector = aMaterial->GetElementVector();
for( G4int i=0; i<aMaterial->GetNumberOfElements(); ++i )
G4int i;
for(i=0; i<aMaterial->GetNumberOfElements(); ++i )
{
sum += aMaterial->GetAtomicNumDensityVector()[i];
if( sum > random ) {
}
G4double running = 0;
for(i=0; i<aMaterial->GetNumberOfElements(); ++i )
{
running += aMaterial->GetAtomicNumDensityVector()[i];
if( running/sum > random ) {
aEff = (*theElementVector)(i)->GetA()*mole/g;
zEff = (*theElementVector)(i)->GetZ();
break;
@@ -108,8 +114,8 @@
G4int myZ = G4int(Z + 0.5);
G4int myA = G4int(A + 0.5);
if( myZ < 0 )return 0.0;
if( myZ > myA )return 0.0;
if( myA <= 0 )return DBL_MAX;
if( myZ > myA)return DBL_MAX;
if( myA == 1 )
{
if( myZ == 0 )return neutron_mass*MeV;
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4ReactionDynamics.cc,v 2.9 1998/12/15 13:43:28 hpw Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4ReactionDynamics.cc,v 1.4 1999/06/17 13:41:37 allison Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// Hadronic Process: Reaction Dynamics
// original by H.P. Wellisch
@@ -31,10 +31,12 @@
// J.L. Chuma, 06-Aug-97: Added original incident particle, before Fermi motion and
// evaporation effects are included, needed for self absorption
// and corrections for single particle spectra (shower particles)
// J. Allison, 17-Jun-99: Replaced a min function to get correct behaviour on DEC.
#include "G4ReactionDynamics.hh"
#include "Randomize.hh"
#include <iostream.h>
// #include "DumpFrame.hh"
//#include "../../alpha_test/cxx/NametoGheishNumber.cc"
G4bool G4ReactionDynamics::GenerateXandPt(
@@ -60,6 +62,7 @@
//
// internal units are GeV
//
// DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
G4ParticleDefinition *aPiMinus = G4PionMinus::PionMinus();
G4ParticleDefinition *aProton = G4Proton::Proton();
G4ParticleDefinition *aNeutron = G4Neutron::Neutron();
@@ -132,6 +135,7 @@
G4ReactionProduct pTemp = *vec[itemp];
*vec[itemp] = *vec[i];
*vec[i] = pTemp;
// DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
}
for( i=0; i<vecLen; ++i )
{
@@ -199,6 +203,7 @@
}
pVec->SetNewlyAdded( true ); // true is the same as IPA(i)<0
vec.SetElement( vecLen++, pVec );
// DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
backwardEnergy -= pVec->GetMass()/GeV;;
++backwardCount;
}
@@ -209,6 +214,7 @@
G4int is, iskip;
while( forwardEnergy <= 0.0 ) // must eliminate a particle from the forward side
{
// DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
iskip = G4int(G4UniformRand()*forwardCount) + 1; // 1 <= iskip <= forwardCount
is = 0;
G4int forwardParticlesLeft = 0;
@@ -229,6 +235,7 @@
} // |
} // |
} // break goes down to here
// DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
if( forwardParticlesLeft == 0 )
{
forwardEnergy += currentParticle.GetMass()/GeV;
@@ -243,8 +250,10 @@
break;
}
}
// DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
while( backwardEnergy <= 0.0 ) // must eliminate a particle from the backward side
{
// DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
iskip = G4int(G4UniformRand()*backwardCount) + 1; // 1 <= iskip <= backwardCount
is = 0;
G4int backwardParticlesLeft = 0;
@@ -270,6 +279,7 @@
}
}
}
// DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
if( backwardParticlesLeft == 0 )
{
backwardEnergy += targetParticle.GetMass()/GeV;
@@ -282,6 +292,7 @@
break;
}
}
// DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
//
// define initial state vectors for Lorentz transformations
// the pseudoParticles have non-standard masses, hence the "pseudo"
@@ -566,6 +577,7 @@
for( G4int j=i; j<(vecLen-1); ++j )*vec[j] = *vec[j+1]; // shift up
//G4ReactionProduct *temp = vec[vecLen];
//delete temp;
// DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
if( --vecLen == 0 )return false; // all the secondaries have been eliminated
pseudoParticle[6] = pseudoParticle[4] + pseudoParticle[5];
pseudoParticle[6].SetMomentum( 0.0 ); // set z-momentum
@@ -842,7 +854,20 @@
{
const G4double cpar[] = { 0.6, 0.6, 0.35, 0.15, 0.10 };
const G4double gpar[] = { 2.6, 2.6, 1.80, 1.30, 1.20 };
G4int tempCount = min( 5, backwardNucleonCount ) - 1;
// Replaced the following min function to get correct behaviour on DEC.
// G4int tempCount = min( 5, backwardNucleonCount ) - 1;
G4int tempCount;
if (backwardNucleonCount < 5)
{
tempCount = backwardNucleonCount;
}
else
{
tempCount = 5;
}
tempCount--;
//cout << "backwardNucleonCount " << backwardNucleonCount << endl;
//cout << "tempCount " << tempCount << endl;
G4double rmb0 = 0.0;
if( targetParticle.GetSide() == -3 )
rmb0 += targetParticle.GetMass()/GeV;
@@ -888,10 +913,12 @@
exit( EXIT_FAILURE );
}
constantCrossSection = true;
// DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
if( tempLen >= 2 )
{
wgt = GenerateNBodyEvent(
pseudoParticle[6].GetMass(), constantCrossSection, tempV, tempLen );
// DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
if( targetParticle.GetSide() == -3 )
{
targetParticle.Lorentz( targetParticle, pseudoParticle[6] );
@@ -906,12 +933,14 @@
pseudoParticle[5] = pseudoParticle[5] + (*vec[i]);
}
}
// DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
}
}
//
// Lorentz transformation in lab system
//
if( vecLen == 0 )return false; // all the secondaries have been eliminated
// DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
G4int numberofFinalStateNucleons = 0;
if( (currentParticle.GetDefinition() == aProton) ||
@@ -928,6 +957,7 @@
(vec[i]->GetDefinition() == aNeutron) )++numberofFinalStateNucleons;
vec[i]->Lorentz( *vec[i], pseudoParticle[1] );
}
// DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
numberofFinalStateNucleons = max( 1, numberofFinalStateNucleons );
//
// leadFlag will be true
@@ -983,11 +1013,13 @@
{
targetParticle.SetDefinitionAndUpdateE( leadingStrangeParticle.GetDefinition() );
targetHasChanged = true;
// DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
}
else
{
currentParticle.SetDefinitionAndUpdateE( leadingStrangeParticle.GetDefinition() );
incidentHasChanged = false;
// DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
}
}
} // end of if( leadFlag )
@@ -1051,6 +1083,7 @@
pseudoParticle[6].Lorentz( *tempV[i], pseudoParticle[4] );
theoreticalKinetic += pseudoParticle[6].GetKineticEnergy()/MeV;
}
// DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
//delete [] tempR;
}
//
@@ -1081,6 +1114,7 @@
simulatedKinetic += theoreticalKinetic;
pp = targetParticle.GetTotalMomentum()/MeV;
pp1 = targetParticle.GetMomentum().mag()/MeV;
// DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
if( pp1 < 1.0e-6*GeV )
{
rthnve = pi*G4UniformRand();
@@ -1110,9 +1144,11 @@
vec[i]->SetMomentum( vec[i]->GetMomentum() * (pp/pp1) );
}
}
// DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
Rotate( numberofFinalStateNucleons, pseudoParticle[3].GetMomentum(),
modifiedOriginal, originalIncident, targetNucleus,
currentParticle, targetParticle, vec, vecLen );
// DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
//
// add black track particles
// the total number of particles produced is restricted to 198
@@ -1151,9 +1187,11 @@
ndta = min( ndta, 127-vecLen );
}
G4double spall = numberofFinalStateNucleons;
// DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
AddBlackTrackParticles( epnb, npnb, edta, ndta, sprob, kineticMinimum, kineticFactor,
modifiedOriginal, spall, targetNucleus,
vec, vecLen );
// DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
}
if( centerofmassEnergy <= (4.0+G4UniformRand()) )
MomentumCheck( modifiedOriginal, currentParticle, targetParticle, vec, vecLen );
@@ -1165,6 +1203,7 @@
else
currentParticle.SetTOF( 1.0 );
return true;
// DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
}
void G4ReactionDynamics::SuppressChargedPions(
@@ -1222,6 +1261,7 @@
targetParticle.SetDefinitionAndUpdateE( aProton );
targetHasChanged = true;
}
// DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
for( G4int i=0; i<vecLen; ++i )
{
if( antiTest && (
@@ -1235,8 +1275,10 @@
vec[i]->SetDefinitionAndUpdateE( aNeutron );
else
vec[i]->SetDefinitionAndUpdateE( aProton );
// DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
}
}
// DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
}
G4bool G4ReactionDynamics::TwoCluster(
@@ -1252,6 +1294,7 @@
G4bool leadFlag,
G4ReactionProduct &leadingStrangeParticle )
{
// DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
// derived from original FORTRAN code TWOCLU by H. Fesefeldt (11-Oct-1987)
//
// Generation of X- and PT- values for incident, target, and all secondary particles
@@ -1376,8 +1419,10 @@
extraMass += pVec->GetMass()/GeV;
pVec->SetNewlyAdded( true );
vec.SetElement( vecLen++, pVec );
// DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
}
}
// DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
G4double forwardEnergy = centerofmassEnergy/2.0 - forwardMass;
G4double backwardEnergy = centerofmassEnergy/2.0 - backwardMass;
G4double eAvailable = centerofmassEnergy - (forwardMass+backwardMass);
@@ -1409,7 +1454,11 @@
break;
}
} // breaks go down to here
if( secondaryDeleted )--vecLen;
if( secondaryDeleted )
{
--vecLen;
// DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
}
else
{
if( vecLen == 0 )return false; // all secondaries have been eliminated
@@ -1433,7 +1482,11 @@
forwardMass -= pMass;
secondaryDeleted = true;
}
if( secondaryDeleted )--vecLen;
if( secondaryDeleted )
{
--vecLen;
// DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
}
else
{
if( currentParticle.GetSide() == -1 )
@@ -1456,7 +1509,11 @@
forwardMass -= pMass;
secondaryDeleted = true;
}
if( secondaryDeleted )--vecLen;
if( secondaryDeleted )
{
--vecLen;
// DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
}
else break;
}
}
@@ -1605,6 +1662,7 @@
vec[i]->Lorentz( *vec[i], pseudoParticle[0] );
}
}
// DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
}
//
// fragmentation of forward cluster and backward meson cluster
@@ -1624,6 +1682,7 @@
pseudoParticle[6].SetTotalEnergy( pseudoParticle[4].GetTotalEnergy() );
G4double wgt;
// DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
if( forwardCount > 1 ) // tempV will contain the forward particles
{
G4FastVector<G4ReactionProduct,128> tempV;
@@ -1661,6 +1720,7 @@
}
}
}
// DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
if( backwardCount > 1 ) // tempV will contain the backward particles,
{ // but not those created from the intranuclear cascade
G4FastVector<G4ReactionProduct,128> tempV;
@@ -1700,6 +1760,7 @@
}
}
}
// DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
//
// Lorentz transformation in lab system
//
@@ -1713,6 +1774,7 @@
if( vec[i]->GetMass() > 0.5*GeV )++numberofFinalStateNucleons;
vec[i]->Lorentz( *vec[i], pseudoParticle[2] );
}
// DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
numberofFinalStateNucleons = max( 1, numberofFinalStateNucleons );
//
// sometimes the leading strange particle is lost, set it back
@@ -1827,6 +1889,7 @@
if( tempLen >= 2 )
{
// DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
wgt = GenerateNBodyEvent(
pseudoParticle[4].GetTotalEnergy()/MeV+pseudoParticle[5].GetTotalEnergy()/MeV,
constantCrossSection, tempV, tempLen );
@@ -1840,6 +1903,7 @@
theoreticalKinetic += pseudoParticle[7].GetKineticEnergy()/GeV;
}
}
// DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
//delete [] tempR;
}
else
@@ -1903,6 +1967,7 @@
vec[i]->SetMomentum( vec[i]->GetMomentum() * (pp/pp1) );
}
}
// DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
Rotate( numberofFinalStateNucleons, pseudoParticle[4].GetMomentum(),
modifiedOriginal, originalIncident, targetNucleus,
currentParticle, targetParticle, vec, vecLen );
@@ -1946,9 +2011,11 @@
ndta = min( ndta, 127-vecLen );
}
G4double spall = numberofFinalStateNucleons;
// DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
AddBlackTrackParticles( epnb, npnb, edta, ndta, sprob, kineticMinimum, kineticFactor,
modifiedOriginal, spall, targetNucleus,
vec, vecLen );
// DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
}
if( centerofmassEnergy <= (4.0+G4UniformRand()) )
MomentumCheck( modifiedOriginal, currentParticle, targetParticle, vec, vecLen );
@@ -1960,6 +2027,7 @@
else
currentParticle.SetTOF( 1.0 );
// DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
return true;
}
@@ -1993,6 +2061,7 @@
G4ParticleDefinition *aKaonZeroS = G4KaonZeroShort::KaonZeroShort();
G4ParticleDefinition *aKaonZeroL = G4KaonZeroLong::KaonZeroLong();
// DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
const G4double kaonMinusMass = aKaonMinus->GetPDGMass()/GeV;
static const G4double expxu = 82.; // upper bound for arg. of exp
@@ -2174,6 +2243,7 @@
}
}
}
// DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
if( atomicWeight >= 1.5 )
{
// Add black track particles
@@ -2209,9 +2279,11 @@
ndta = min( ndta, 127-vecLen );
}
G4double spall = 0.0;
// DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
AddBlackTrackParticles( epnb, npnb, edta, ndta, sprob, kineticMinimum, kineticFactor,
modifiedOriginal, spall, targetNucleus,
vec, vecLen );
// DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
}
//
// calculate time delay for nuclear reactions
@@ -2229,6 +2301,7 @@
G4FastVector<G4ReactionProduct,128> &vec,
G4int &vecLen )
{
// // DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
// derived from original FORTRAN code PHASP by H. Fesefeldt (02-Dec-1986)
// Returns the weight of the event
//
@@ -2426,6 +2499,7 @@
//delete [] emm;
//delete [] sm;
//delete [] pd;
// DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
return weight;
}
@@ -2928,6 +3002,7 @@
vec[vecLen++]->SetMomentum( pp*sint*sin(phi)*MeV,
pp*sint*cos(phi)*MeV,
pp*cost*MeV );
// DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
}
if( (atomicWeight >= 10.0) && (ekOriginal <= 2.0*GeV) )
{
@@ -2992,6 +3067,7 @@
vec[vecLen++]->SetMomentum( pp*sint*sin(phi)*MeV,
pp*sint*cos(phi)*MeV,
pp*cost*MeV );
// DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
}
}
}
@@ -3170,6 +3246,7 @@
p1->SetDefinition( anAntiProton );
}
vec.SetElement( vecLen++, p1 );
// DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
}
else
{ // replace two secondaries
@@ -3229,6 +3306,7 @@
break;
}
vec.SetElement( vecLen++, p1 );
// DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
}
else // replace
{
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4ReactionKinematics.cc,v 2.1 1998/10/02 17:24:09 pia Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4ReactionKinematics.cc,v 1.1 1999/01/07 16:13:52 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// CERN Geneva Switzerland
//
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4ReactionProduct.cc,v 2.1 1998/11/06 10:59:11 hpw Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4ReactionProduct.cc,v 1.1 1999/01/07 16:13:52 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// J.L. Chuma, TRIUMF, 31-Oct-1996
// last modified: 19-Dec-1996
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4StableIsotopes.cc,v 2.0 1998/07/02 16:39:02 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4StableIsotopes.cc,v 1.1 1999/01/07 16:13:52 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
#include "G4StableIsotopes.hh"