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
@@ -14,15 +14,15 @@
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * authors in the GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4EnergyRangeManager.cc,v 1.3.8.1 2001/06/28 19:12:57 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4EnergyRangeManager.cc,v 1.5 2001/08/01 17:03:25 hpw Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
// Hadronic Process: Energy Range Manager
// original by H.P. Wellisch
@@ -14,7 +14,7 @@
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * authors in the GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
@@ -53,24 +53,20 @@
// returns the mean free path in GEANT4 internal units
const G4RWTPtrVector<G4Element> *theElementVector =
aMaterial->GetElementVector();
const G4double *theAtomicNumDensityVector =
aMaterial->GetAtomicNumDensityVector();
G4double aTemp = aMaterial->GetTemperature();
G4Element *anElement = (*theElementVector)[0];
G4int j = anElement->GetIndex();
G4double sigma = 0.0;
for( G4int i=0; i<nElements; ++i )
{
G4double xSection =
GetMicroscopicCrossSection( aParticle, (*theElementVector)[i], aTemp);
GetMicroscopicCrossSection( aParticle, (*aMaterial->GetElementVector())[i], aTemp);
sigma += theAtomicNumDensityVector[i] * xSection;
}
sigma *= aScaleFactor;
theLastCrossSection = sigma;
if( sigma > 0.0 )
return 1.0/sigma;
else
@@ -14,15 +14,12 @@
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * authors in the GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4HadronicInteraction.cc,v 1.2.8.1 2001/06/28 19:12:57 gunter Exp $
// GEANT4 tag $Name: $
//
// Hadronic Interaction base class
// original by H.P. Wellisch
@@ -46,6 +43,7 @@
{
if( aMaterial == theMinMaterials[i] )return theMinEnergyList[i];
}
if(IsBlocked()) return 0.*GeV;
if( verboseLevel > 0 )
G4cout << "*** Warning from HadronicInteraction::GetMinEnergy" << G4endl
<< " material " << aMaterial->GetName()
@@ -116,6 +114,7 @@
{
if( aMaterial == theMaxMaterials[i] )return theMaxEnergyList[i];
}
if(IsBlocked()) return 0.*GeV;
if( verboseLevel > 0 )
G4cout << "*** Warning from HadronicInteraction::GetMaxEnergy" << G4endl
<< " material " << aMaterial->GetName()
@@ -14,7 +14,7 @@
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * authors in the GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
@@ -46,7 +46,7 @@ AddModel(G4HadronicInteraction * aModel)
G4bool alreadyThere = false;
for(G4int i=0; i<nModels; i++)
{
if(allModels(i)==aModel)
if(allModels[i]==aModel)
{
alreadyThere = true;
break;
@@ -55,7 +55,6 @@ AddModel(G4HadronicInteraction * aModel)
if(!alreadyThere)
{
nModels++;
allModels.resize(nModels);
allModels(nModels-1) = aModel;
allModels.push_back(aModel);
}
}
@@ -14,7 +14,7 @@
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * authors in the GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
@@ -45,10 +45,10 @@
if( numberOfElements == 1 )
{
currentZ = G4double((*theElementVector)(0)->GetZ());
currentN = (*theElementVector)(0)->GetN();
currentZ = G4double( ((*theElementVector)[0])->GetZ());
currentN = (*theElementVector)[0]->GetN();
targetNucleus.SetParameters(currentN, currentZ);
return (*theElementVector)(0);
return (*theElementVector)[0];
}
const G4double *theAtomicNumberDensity = aMaterial->GetAtomicNumDensityVector();
@@ -59,7 +59,7 @@
for( i=0; i < numberOfElements; ++i )
{
runningSum.push_back(theAtomicNumberDensity[i] *
dispatch->GetMicroscopicCrossSection( aParticle, (*theElementVector)(i), aTemp));
dispatch->GetMicroscopicCrossSection( aParticle, (*theElementVector)[i], aTemp));
crossSectionTotal+=runningSum[i];
}
@@ -68,16 +68,16 @@
{
if( random<=runningSum[i]/crossSectionTotal )
{
currentZ = G4double((*theElementVector)(i)->GetZ());
currentN = (*theElementVector)(i)->GetN();
currentZ = G4double( ((*theElementVector)[i])->GetZ());
currentN = ((*theElementVector)[i])->GetN();
targetNucleus.SetParameters(currentN, currentZ);
return (*theElementVector)(i);
return (*theElementVector)[i];
}
}
currentZ = G4double((*theElementVector)(numberOfElements-1)->GetZ());
currentN = (*theElementVector)(numberOfElements-1)->GetN();
currentZ = G4double((*theElementVector)[numberOfElements-1]->GetZ());
currentN = (*theElementVector)[numberOfElements-1]->GetN();
targetNucleus.SetParameters(currentN, currentZ);
return (*theElementVector)(numberOfElements-1);
return (*theElementVector)[numberOfElements-1];
}
G4VParticleChange *G4HadronicProcess::GeneralPostStepDoIt(
@@ -91,7 +91,18 @@
aMaterial, anElement );
G4VParticleChange *result =
theInteraction->ApplyYourself( aTrack, targetNucleus);
ResetNumberOfInteractionLengthLeft();
if(getenv("HadronicDoitLogging") )
{
G4cout << "HadronicDoitLogging "
<< GetProcessName() <<" "
<< aParticle->GetDefinition()->GetPDGEncoding()<<" "
<< kineticEnergy<<" "
<< aParticle->GetMomentum()<<" "
<< targetNucleus.GetN()<<" "
<< targetNucleus.GetZ()<<" "
<< G4endl;
}
ClearNumberOfInteractionLengthLeft();
if(isoIsOnAnyway!=-1)
{
if(isoIsEnabled||isoIsOnAnyway)
@@ -113,9 +124,9 @@
theIsoResult = new G4IsoParticleChange;
G4bool done = false;
G4IsoResult * anIsoResult = NULL;
for(G4int i=0; i<theProductionModels.length(); i++)
for(unsigned int i=0; i<theProductionModels.size(); i++)
{
anIsoResult = theProductionModels(i)->GetIsotope(aTrack, aNucleus);
anIsoResult = theProductionModels[i]->GetIsotope(aTrack, aNucleus);
if(anIsoResult!=NULL)
{
done = true;
@@ -175,7 +186,7 @@
// prepare the IsoResult.
char the1[100] = {""};
G4std::ostrstream ost1(the1, 100, G4std::ios::out);
ost1 <<Z<<"_"<<A;
ost1 <<Z<<"_"<<A<<"\0";
G4String * biff = new G4String(the1);
G4IsoResult * theResult = new G4IsoResult(*biff, aNucleus);
@@ -14,7 +14,7 @@
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * authors in the GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
@@ -179,6 +179,7 @@
G4bool &targetHasChanged,
G4bool quasiElastic )
{
what = originalIncident->GetMomentum();
theReactionDynamics.ProduceStrangeParticlePairs( vec, vecLen,
modifiedOriginal, originalTarget,
currentParticle, targetParticle,
@@ -252,7 +253,11 @@
targetNucleus, incidentHasChanged,
targetHasChanged, leadFlag,
leadingStrangeParticle );
if( finishedGenXPt )return;
if( finishedGenXPt )
{
Rotate(vec, vecLen);
return;
}
G4bool finishedTwoClu = false;
if( modifiedOriginal.GetTotalMomentum()/MeV < 1.0 )
{
@@ -272,7 +277,11 @@
targetHasChanged, leadFlag,
leadingStrangeParticle );
}
if( finishedTwoClu )return;
if( finishedTwoClu )
{
Rotate(vec, vecLen);
return;
}
//
// PNBlackTrackEnergy is the kinetic energy available for
// proton/neutron black track particles [was enp(1) in fortran code]
@@ -299,6 +308,20 @@
targetNucleus, targetHasChanged );
}
void G4InelasticInteraction::
Rotate(G4FastVector<G4ReactionProduct,128> &vec, G4int &vecLen)
{
G4double rotation = 2.*pi*G4UniformRand();
cache = rotation;
G4int i;
for( i=0; i<vecLen; ++i )
{
G4ThreeVector momentum = vec[i]->GetMomentum();
momentum = momentum.rotate(rotation, what);
vec[i]->SetMomentum(momentum);
}
}
void
G4InelasticInteraction::SetUpChange(
G4FastVector<G4ReactionProduct,128> &vec,
@@ -371,7 +394,9 @@
{
G4DynamicParticle *p1 = new G4DynamicParticle;
p1->SetDefinition( targetParticle.GetDefinition() );
p1->SetMomentum( targetParticle.GetMomentum() );
G4ThreeVector momentum = targetParticle.GetMomentum();
momentum = momentum.rotate(cache, what);
p1->SetMomentum( momentum );
theParticleChange.AddSecondary( p1 );
}
G4DynamicParticle *p;