Import Geant4 4.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 16:39:52 +02:00
parent 921d3b1cda
commit 330b82b769
4524 changed files with 178689 additions and 43575 deletions
@@ -22,7 +22,7 @@
//
//
// $Id: G4LightMedia.cc,v 1.5 2001/10/05 16:10:06 hpw Exp $
// GEANT4 tag $Name: geant4-04-00 $
// GEANT4 tag $Name: geant4-04-01 $
//
// Hadronic Process: Light Media Charge and/or Strangeness Exchange
// J.L. Chuma, TRIUMF, 21-Feb-1997
@@ -38,6 +38,37 @@
#include "G4Nucleus.hh"
#include "Randomize.hh"
G4Nucleus::G4Nucleus()
{
pnBlackTrackEnergy = dtaBlackTrackEnergy = 0.0;
excitationEnergy = 0.0;
momentum = G4ThreeVector(0.,0.,0.);
fermiMomentum = 1.52*hbarc/fermi;
theTemp = 293.16*kelvin;
}
G4Nucleus::G4Nucleus( const G4double A, const G4double Z )
{
SetParameters( A, Z );
pnBlackTrackEnergy = dtaBlackTrackEnergy = 0.0;
excitationEnergy = 0.0;
momentum = G4ThreeVector(0.,0.,0.);
fermiMomentum = 1.52*hbarc/fermi;
theTemp = 293.16*kelvin;
}
G4Nucleus::G4Nucleus( const G4Material *aMaterial )
{
ChooseParameters( aMaterial );
pnBlackTrackEnergy = dtaBlackTrackEnergy = 0.0;
excitationEnergy = 0.0;
momentum = G4ThreeVector(0.,0.,0.);
fermiMomentum = 1.52*hbarc/fermi;
theTemp = aMaterial->GetTemperature();
}
G4Nucleus::~G4Nucleus() {}
G4ReactionProduct G4Nucleus::
GetBiasedThermalNucleus(G4double aMass, G4ThreeVector aVelocity, G4double temp) const
{
@@ -295,7 +326,7 @@ G4ReactionProduct G4Nucleus::GetThermalNucleus(G4double targetMass, G4double tem
ranmax = (ranmax>ranflat3? ranmax : ranflat3);
// - random decay angle
G4double theta=RandFlat::shoot((HepDouble)0.,(HepDouble)pi); // isotropic decay angle theta
G4double theta=pi*G4UniformRand(); // isotropic decay angle theta
G4double phi =RandFlat::shoot((HepDouble)0.,(HepDouble)2*pi); // isotropic decay angle phi
// - setup ThreeVector
@@ -96,6 +96,8 @@
G4ParticleDefinition *aKaonZeroL = G4KaonZeroLong::KaonZeroLong();
G4int i, l;
G4double forVeryForward = 0.;
G4bool veryForward = false;
const G4double ekOriginal = modifiedOriginal.GetKineticEnergy()/GeV;
const G4double etOriginal = modifiedOriginal.GetTotalEnergy()/GeV;
@@ -107,8 +109,21 @@
2.0*targetMass*etOriginal ); // GeV
G4double currentMass = currentParticle.GetMass()/GeV;
targetMass = targetParticle.GetMass()/GeV;
//
// randomize the order of the secondary particles
// note that the current and target particles are not affected
//
for( i=0; i<vecLen; ++i )
{
G4int itemp = G4int( G4UniformRand()*vecLen );
G4ReactionProduct pTemp = *vec[itemp];
*vec[itemp] = *vec[i];
*vec[i] = pTemp;
// DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
}
if( currentMass == 0.0 && targetMass == 0.0 ) // annihilation
{
// no kinetic energy in target .....
G4double ek = currentParticle.GetKineticEnergy();
G4ThreeVector m = currentParticle.GetMomentum();
currentParticle = *vec[0];
@@ -120,10 +135,13 @@
delete temp;
vecLen -= 2;
currentMass = currentParticle.GetMass()/GeV;
targetMass = targetParticle.GetMass()/GeV;
incidentHasChanged = true;
targetHasChanged = true;
currentParticle.SetKineticEnergy( ek );
currentParticle.SetMomentum( m );
forVeryForward = aProton->GetPDGMass();
veryForward = true;
}
const G4double atomicWeight = targetNucleus.GetN();
const G4double atomicNumber = targetNucleus.GetZ();
@@ -151,17 +169,22 @@
G4double backwardEnergy = centerofmassEnergy/2.0 - targetMass;
G4int backwardCount = 1; // number of particles in backward hemisphere
//
// randomize the order of the secondary particles
// note that the current and target particles are not affected
//
for( i=0; i<vecLen; ++i )
if(veryForward)
{
G4int itemp = G4int( G4UniformRand()*vecLen );
G4ReactionProduct pTemp = *vec[itemp];
*vec[itemp] = *vec[i];
*vec[i] = pTemp;
// DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
if(currentParticle.GetSide()==-1)
{
forwardEnergy += currentMass;
forwardCount --;
backwardEnergy -= currentMass;
backwardCount ++;
}
if(targetParticle.GetSide()!=-1)
{
backwardEnergy += targetMass;
backwardCount --;
forwardEnergy -= targetMass;
forwardCount ++;
}
}
for( i=0; i<vecLen; ++i )
{
@@ -213,15 +236,15 @@
pVec->SetDefinition( aNeutron );
pVec->SetSide( -2 ); // -2 means backside nucleon
++extraNucleonCount;
backwardEnergy += centerofmassEnergy/2.0;
backwardEnergy += pVec->GetMass()/GeV;
extraNucleonMass += pVec->GetMass()/GeV;
}
else
{
G4double ran = G4UniformRand();
if( ran < 0.33333 )
if( ran < 0.3181 )
pVec->SetDefinition( aPiPlus );
else if( ran < 0.66667 )
else if( ran < 0.6819 )
pVec->SetDefinition( aPiZero );
else
pVec->SetDefinition( aPiMinus );
@@ -230,7 +253,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;;
backwardEnergy -= pVec->GetMass()/GeV;
++backwardCount;
}
}
@@ -248,12 +271,12 @@
{
if( vec[i]->GetSide() == 1 )
{
forwardParticlesLeft = 1;
if( ++is == iskip )
{
forwardEnergy += vec[i]->GetMass()/GeV;
for( G4int j=i; j<(vecLen-1); j++ )*vec[j] = *vec[j+1]; // shift up
--forwardCount;
forwardParticlesLeft = 1;
G4ReactionProduct *temp = vec[vecLen-1];
delete temp;
if( --vecLen == 0 )return false; // all the secondaries have been eliminated
@@ -287,17 +310,18 @@
{
if( vec[i]->GetSide() < 0 )
{
backwardParticlesLeft = 1;
if( ++is == iskip ) // eliminate the i'th particle
{
if( vec[i]->GetSide() == -2 )
{
--extraNucleonCount;
extraNucleonMass -= vec[i]->GetMass()/GeV;
backwardEnergy -= vec[i]->GetTotalEnergy()/GeV;
}
backwardEnergy += vec[i]->GetMass()/GeV;
backwardEnergy += vec[i]->GetTotalEnergy()/GeV;
for( G4int j=i; j<(vecLen-1); ++j )*vec[j] = *vec[j+1]; // shift up
--backwardCount;
backwardParticlesLeft = 1;
G4ReactionProduct *temp = vec[vecLen-1];
delete temp;
if( --vecLen == 0 )return false; // all the secondaries have been eliminated
@@ -308,7 +332,7 @@
// DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
if( backwardParticlesLeft == 0 )
{
backwardEnergy += targetParticle.GetMass()/GeV;
backwardEnergy += targetParticle.GetMass()/GeV;
targetParticle = *vec[0];
--backwardCount;
for( G4int j=0; j<(vecLen-1); ++j )*vec[j] = *vec[j+1];
@@ -598,6 +622,7 @@
{
--extraNucleonCount;
extraNucleonMass -= vecMass;
backwardEnergy -= vecMass;
}
--backwardCount;
backwardEnergy += vecMass;
@@ -844,11 +869,11 @@
}
}
} // closes outer loop
if( eliminateThisParticle ) // not enough energy, eliminate target
{
G4cerr << "Warning: eliminating target particle" << G4endl;
// if( eliminateThisParticle ) // not enough energy, eliminate target
// {
// G4cerr << "Warning: eliminating target particle" << G4endl;
// exit( EXIT_FAILURE );
}
// }
}
//
// this finishes the target particle
@@ -1063,9 +1088,13 @@
// G4double ekin0 = pseudoParticle[3].GetKineticEnergy()/GeV;
G4ParticleDefinition * aOrgDef = modifiedOriginal.GetDefinition();
G4int diff = 0;
if(aOrgDef == G4Proton::Proton() || aOrgDef == G4Neutron::Neutron() ) diff = 1;
if(numberofFinalStateNucleons == 1) diff = 0;
pseudoParticle[4].SetMomentum( 0.0, 0.0, 0.0 );
pseudoParticle[4].SetMass( protonMass*numberofFinalStateNucleons*MeV );
pseudoParticle[4].SetTotalEnergy( protonMass*numberofFinalStateNucleons*MeV );
pseudoParticle[4].SetMass( protonMass*(numberofFinalStateNucleons-diff)*MeV );
pseudoParticle[4].SetTotalEnergy( protonMass*(numberofFinalStateNucleons-diff)*MeV );
G4double theoreticalKinetic =
pseudoParticle[3].GetTotalEnergy()/MeV +
@@ -1106,8 +1135,8 @@
for( i=0; i<vecLen+2; ++i )tempV.SetElement( tempLen++, &tempR[i] );
constantCrossSection = true;
wgt = GenerateNBodyEvent(
pseudoParticle[3].GetTotalEnergy()/MeV+pseudoParticle[4].GetTotalEnergy()/MeV,
wgt = GenerateNBodyEvent( pseudoParticle[3].GetTotalEnergy()/MeV+
pseudoParticle[4].GetTotalEnergy()/MeV,
constantCrossSection, tempV, tempLen );
theoreticalKinetic = 0.0;
for( i=0; i<tempLen; ++i )
@@ -1444,9 +1473,9 @@
else
{ // add a pion
G4double ran = G4UniformRand();
if( ran < 0.33333 )
if( ran < 0.3181 )
pVec->SetDefinition( aPiPlus );
else if( ran < 0.66667 )
else if( ran < 0.6819 )
pVec->SetDefinition( aPiZero );
else
pVec->SetDefinition( aPiMinus );
@@ -1810,13 +1839,16 @@
// Lorentz transformation in lab system
//
G4int numberofFinalStateNucleons = 0;
if( currentParticle.GetMass() > 0.5*GeV )++numberofFinalStateNucleons;
if( currentParticle.GetDefinition() ==aProton ||
currentParticle.GetDefinition() == aNeutron ) ++numberofFinalStateNucleons;
currentParticle.Lorentz( currentParticle, pseudoParticle[2] );
if( targetParticle.GetMass() > 0.5*GeV )++numberofFinalStateNucleons;
if( targetParticle.GetDefinition() ==aProton ||
targetParticle.GetDefinition() == aNeutron) ++numberofFinalStateNucleons;
targetParticle.Lorentz( targetParticle, pseudoParticle[2] );
for( i=0; i<vecLen; ++i )
{
if( vec[i]->GetMass() > 0.5*GeV )++numberofFinalStateNucleons;
if( vec[i]->GetDefinition() ==aProton ||
vec[i]->GetDefinition() == aNeutron)++numberofFinalStateNucleons;
vec[i]->Lorentz( *vec[i], pseudoParticle[2] );
}
// DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
@@ -1906,9 +1938,13 @@
pseudoParticle[4].SetTotalEnergy( etOriginal*GeV );
pseudoParticle[4].SetMomentum( 0.0, 0.0, pOriginal*GeV );
G4ParticleDefinition * aOrgDef = modifiedOriginal.GetDefinition();
G4int diff = 0;
if(aOrgDef == G4Proton::Proton() || aOrgDef == G4Neutron::Neutron() ) diff = 1;
if(numberofFinalStateNucleons == 1) diff = 0;
pseudoParticle[5].SetMomentum( 0.0, 0.0, 0.0 );
pseudoParticle[5].SetMass( protonMass*numberofFinalStateNucleons*MeV );
pseudoParticle[5].SetTotalEnergy( protonMass*numberofFinalStateNucleons*MeV );
pseudoParticle[5].SetMass( protonMass*(numberofFinalStateNucleons-diff)*MeV );
pseudoParticle[5].SetTotalEnergy( protonMass*(numberofFinalStateNucleons-diff)*MeV );
// G4double ekin0 = pseudoParticle[4].GetKineticEnergy()/GeV;
G4double theoreticalKinetic =
@@ -1917,7 +1953,7 @@
pseudoParticle[6] = pseudoParticle[4] + pseudoParticle[5];
pseudoParticle[4].Lorentz( pseudoParticle[4], pseudoParticle[6] );
pseudoParticle[5].Lorentz( pseudoParticle[5], pseudoParticle[6] );
if( vecLen < 16 )
{
G4ReactionProduct tempR[130];
@@ -2717,9 +2753,11 @@
pseudoParticle[3] = pseudoParticle[0];
pseudoParticle[1] = pseudoParticle[2].cross(pseudoParticle[3]);
G4double rotation = 2.*pi*G4UniformRand();
pseudoParticle[1] = pseudoParticle[1].rotate(rotation, pseudoParticle[3]);
pseudoParticle[2] = pseudoParticle[3].cross(pseudoParticle[1]);
for(G4int ii=1; ii<=3; ii++)
{
{
p = pseudoParticle[ii].mag();
if( p == 0.0 )
pseudoParticle[ii]= G4ThreeVector( 0.0, 0.0, 0.0 );
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4ReactionKinematics.cc,v 1.4 2001/08/01 17:12:47 hpw Exp $
// GEANT4 tag $Name: geant4-04-00 $
// $Id: G4ReactionKinematics.cc,v 1.5 2002/02/12 18:56:58 hpw Exp $
// GEANT4 tag $Name: geant4-04-01 $
//
// CERN Geneva Switzerland
//
@@ -60,7 +60,7 @@ void G4ReactionKinematics::TwoBodyScattering(
G4double breakupMomentum=BreakupMomentum(invariantMass, massOut1, massOut2);
// - random decay angle
G4double theta=RandFlat::shoot(HepDouble(0.),HepDouble(pi)); // isotropic decay angle theta
G4double theta=pi*G4UniformRand(); // isotropic decay angle theta
G4double phi =RandFlat::shoot(HepDouble(0.),HepDouble(twopi)); // isotropic decay angle phi
// - setup LorentzVectors
@@ -22,7 +22,7 @@
//
//
// $Id: G4ReactionProduct.cc,v 1.4 2001/08/01 17:12:48 hpw Exp $
// GEANT4 tag $Name: geant4-04-00 $
// GEANT4 tag $Name: geant4-04-01 $
//
// J.L. Chuma, TRIUMF, 31-Oct-1996
// last modified: 19-Dec-1996
@@ -22,7 +22,7 @@
//
//
// $Id: G4StableIsotopes.cc,v 1.4 2001/08/01 17:12:48 hpw Exp $
// GEANT4 tag $Name: geant4-04-00 $
// GEANT4 tag $Name: geant4-04-01 $
//
#include "G4StableIsotopes.hh"