Import Geant4 1.0.0 source tree
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
# $Id: GNUmakefile,v 1.1 1999/11/03 15:38:30 hpw Exp $
|
||||
# -----------------------------------------------------------
|
||||
# GNUmakefile for hadronic library. Gabriele Cosmo, 18/9/96.
|
||||
# -----------------------------------------------------------
|
||||
|
||||
name := G4hadronic_iso
|
||||
|
||||
ifndef G4INSTALL
|
||||
G4INSTALL = ../../../../..
|
||||
endif
|
||||
|
||||
include $(G4INSTALL)/config/architecture.gmk
|
||||
|
||||
G4TMPDIR = $(G4TMP)/$(G4SYSTEM)/$(name)
|
||||
|
||||
CPPFLAGS += -I$(G4BASE)/global/management/include \
|
||||
-I$(G4BASE)/global/HEPRandom/include \
|
||||
-I$(G4BASE)/global/HEPGeometry/include \
|
||||
-I$(G4BASE)/track/include \
|
||||
-I$(G4BASE)/geometry/volumes/include \
|
||||
-I$(G4BASE)/geometry/management/include \
|
||||
-I$(G4BASE)/processes/management/include \
|
||||
-I$(G4BASE)/processes/hadronic/management/include/ \
|
||||
-I$(G4BASE)/processes/hadronic/util/include \
|
||||
-I$(G4BASE)/processes/hadronic/processes/include \
|
||||
-I$(G4BASE)/processes/hadronic/cross_sections/include \
|
||||
-I$(G4BASE)/processes/hadronic/models/neutron_hp/include \
|
||||
-I$(G4BASE)/particles/management/include \
|
||||
-I$(G4BASE)/particles/leptons/include \
|
||||
-I$(G4BASE)/particles/bosons/include \
|
||||
-I$(G4BASE)/particles/hadrons/mesons/include \
|
||||
-I$(G4BASE)/particles/hadrons/barions/include \
|
||||
-I$(G4BASE)/particles/hadrons/ions/include \
|
||||
-I$(G4BASE)/materials/include
|
||||
|
||||
include $(G4INSTALL)/config/common.gmk
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
#ifndef G4NeutronElementCrossSections_h
|
||||
#define G4NeutronElementCrossSections_h
|
||||
|
||||
class G4NeutronElementCrossSections
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
#endif
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
#ifndef G4NeutronElementIsoCrossSections_h
|
||||
#define G4NeutronElementIsoCrossSections_h
|
||||
|
||||
#include "G4NeutronIsoIsoCrossSections.hh"
|
||||
#include "G4StableIsotopes.hh"
|
||||
#include "G4IsoResult.hh"
|
||||
#include "Randomize.hh"
|
||||
|
||||
class G4NeutronElementIsoCrossSections
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
G4NeutronElementIsoCrossSections();
|
||||
~G4NeutronElementIsoCrossSections();
|
||||
void Init(const G4Element * anElement);
|
||||
|
||||
G4double GetCrossSection(G4double anEnergy);
|
||||
G4IsoResult * GetProductIsotope(G4double anEnergy);
|
||||
|
||||
private:
|
||||
|
||||
G4NeutronIsoIsoCrossSections ** theData;
|
||||
G4int nIsotopes;
|
||||
G4StableIsotopes theStableOnes;
|
||||
G4double crossSectionBuffer;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
#ifndef G4NeutronIsoIsoCrossSections_h
|
||||
#define G4NeutronIsoIsoCrossSections_h
|
||||
|
||||
#include "G4NeutronHPVector.hh"
|
||||
#include "G4NeutronIsoProdCrossSections.hh"
|
||||
#include "G4NeutronHPNames.hh"
|
||||
|
||||
class G4NeutronIsoIsoCrossSections
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
G4NeutronIsoIsoCrossSections();
|
||||
~G4NeutronIsoIsoCrossSections();
|
||||
void Init(G4int A, G4int Z, G4double frac);
|
||||
G4double GetCrossSection(G4double anEnergy);
|
||||
G4String GetProductIsotope(G4double anEnergy);
|
||||
|
||||
G4int GetZ() { return theZ; }
|
||||
G4int GetA() { return theA; }
|
||||
|
||||
private:
|
||||
|
||||
G4int theNumberOfProducts;
|
||||
G4NeutronIsoProdCrossSections ** theProductionData;
|
||||
G4NeutronHPVector theCrossSection;
|
||||
G4NeutronHPNames theNames;
|
||||
G4bool hasData;
|
||||
G4int theA;
|
||||
G4int theZ;
|
||||
};
|
||||
|
||||
#endif
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
#ifndef G4NeutronIsoProdCrossSections_h
|
||||
#define G4NeutronIsoProdCrossSections_h
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4NeutronHPVector.hh"
|
||||
|
||||
class G4NeutronIsoProdCrossSections
|
||||
{
|
||||
public:
|
||||
G4NeutronIsoProdCrossSections(G4String aString)
|
||||
{ theProductName=aString; }
|
||||
void Init(ifstream & aDataSet);
|
||||
G4double GetProductionCrossSection(G4double anEnergy);
|
||||
G4String GetProductIsotope();
|
||||
|
||||
private:
|
||||
|
||||
G4String theProductName;
|
||||
G4NeutronHPVector theProductionCrossSections;
|
||||
};
|
||||
|
||||
#endif
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
#ifndef G4NeutronIsotopeProduction_h
|
||||
#define G4NeutronIsotopeProduction_h
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4VIsotopeProduction.hh"
|
||||
#include "G4NeutronElementIsoCrossSections.hh"
|
||||
#include "Randomize.hh"
|
||||
|
||||
class G4NeutronIsotopeProduction : public G4VIsotopeProduction
|
||||
{
|
||||
public:
|
||||
|
||||
G4NeutronIsotopeProduction();
|
||||
~G4NeutronIsotopeProduction();
|
||||
|
||||
G4IsoResult * GetIsotope(const G4Track & aTrack, const G4Nucleus & aNucleus);
|
||||
|
||||
private:
|
||||
|
||||
G4NeutronElementIsoCrossSections ** theData;
|
||||
G4int numberOfElements;
|
||||
};
|
||||
|
||||
#endif
|
||||
+85
@@ -0,0 +1,85 @@
|
||||
#include "G4NeutronElementIsoCrossSections.hh"
|
||||
|
||||
G4NeutronElementIsoCrossSections::
|
||||
G4NeutronElementIsoCrossSections()
|
||||
{
|
||||
nIsotopes = 0;
|
||||
theData = NULL;
|
||||
}
|
||||
|
||||
G4NeutronElementIsoCrossSections::
|
||||
~G4NeutronElementIsoCrossSections()
|
||||
{
|
||||
for(G4int i=0; i<nIsotopes; i++)
|
||||
{
|
||||
delete theData[i];
|
||||
}
|
||||
delete theData;
|
||||
}
|
||||
|
||||
void G4NeutronElementIsoCrossSections::
|
||||
Init(const G4Element * anElement)
|
||||
{
|
||||
G4int Z = anElement->GetZ();
|
||||
nIsotopes = anElement->GetNumberOfIsotopes();
|
||||
G4bool useIsotopesFromElement = true;
|
||||
if( nIsotopes == 0 )
|
||||
{
|
||||
nIsotopes += theStableOnes.GetNumberOfIsotopes(Z);
|
||||
useIsotopesFromElement = false;
|
||||
}
|
||||
theData = new G4NeutronIsoIsoCrossSections * [nIsotopes];
|
||||
if(useIsotopesFromElement)
|
||||
{
|
||||
for (G4int i=0; i<nIsotopes; i++)
|
||||
{
|
||||
G4int A = anElement->GetIsotope(i)->GetN();
|
||||
G4double frac = anElement->GetRelativeAbundanceVector()[i]/perCent;
|
||||
theData[i] = new G4NeutronIsoIsoCrossSections;
|
||||
theData[i]->Init(A, Z, frac);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
G4int first = theStableOnes.GetFirstIsotope(Z);
|
||||
for(G4int i=0; i<theStableOnes.GetNumberOfIsotopes(Z); i++)
|
||||
{
|
||||
G4int A = theStableOnes.GetIsotopeNucleonCount(first+i);
|
||||
G4double frac = theStableOnes.GetAbundance(first+i);
|
||||
theData[i] = new G4NeutronIsoIsoCrossSections;
|
||||
theData[i]->Init(A, Z, frac);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
G4double G4NeutronElementIsoCrossSections::
|
||||
GetCrossSection(G4double anEnergy)
|
||||
{
|
||||
G4double result = 0;
|
||||
for(G4int i=0; i<nIsotopes; i++)
|
||||
{
|
||||
result += theData[i]->GetCrossSection(anEnergy);
|
||||
}
|
||||
crossSectionBuffer = result;
|
||||
return result;
|
||||
}
|
||||
|
||||
G4IsoResult * G4NeutronElementIsoCrossSections::
|
||||
GetProductIsotope(G4double anEnergy)
|
||||
{
|
||||
G4double running = 0;
|
||||
G4int index;
|
||||
G4double random = G4UniformRand();
|
||||
for(G4int i=0; i<nIsotopes; i++)
|
||||
{
|
||||
running += theData[i]->GetCrossSection(anEnergy);
|
||||
index = i;
|
||||
if(running/crossSectionBuffer > random) break;
|
||||
}
|
||||
G4String result = theData[index]->GetProductIsotope(anEnergy);
|
||||
G4Nucleus nucleus(theData[index]->GetA(), theData[index]->GetZ());
|
||||
G4IsoResult * theResult = new G4IsoResult(result, nucleus);
|
||||
return theResult;
|
||||
}
|
||||
|
||||
|
||||
+222
@@ -0,0 +1,222 @@
|
||||
#include "G4NeutronIsoIsoCrossSections.hh"
|
||||
#include "G4NeutronHPDataUsed.hh"
|
||||
#include "G4NeutronInelasticCrossSection.hh"
|
||||
|
||||
G4NeutronIsoIsoCrossSections::
|
||||
G4NeutronIsoIsoCrossSections()
|
||||
: theCrossSection(), theNames()
|
||||
{
|
||||
theProductionData = NULL;
|
||||
hasData = false;
|
||||
theNumberOfProducts = 0;
|
||||
theZ = 0;
|
||||
theA = 0;
|
||||
}
|
||||
|
||||
G4NeutronIsoIsoCrossSections::
|
||||
~G4NeutronIsoIsoCrossSections()
|
||||
{
|
||||
for(G4int i=0; i<theNumberOfProducts; i++)
|
||||
{
|
||||
delete theProductionData[i];
|
||||
}
|
||||
delete theProductionData;
|
||||
}
|
||||
|
||||
void G4NeutronIsoIsoCrossSections::
|
||||
Init(G4int A, G4int Z, G4double frac)
|
||||
{
|
||||
frac = frac/100.;
|
||||
// First transmution scattering cross-section
|
||||
// in our definition inelastic and fission.
|
||||
|
||||
theZ = Z;
|
||||
theA = A;
|
||||
theNames.SetMaxOffSet(5);
|
||||
G4NeutronHPDataUsed dataUsed;
|
||||
G4String rest = "/CrossSection/";
|
||||
G4String base = getenv("NeutronHPCrossSections");
|
||||
G4String base1 = base + "/Inelastic/";
|
||||
G4bool hasInelasticData = false;
|
||||
dataUsed = theNames.GetName(A, Z, base1, rest, hasInelasticData);
|
||||
G4String aName = dataUsed.GetName();
|
||||
G4NeutronHPVector inelasticData;
|
||||
G4double dummy;
|
||||
G4int total;
|
||||
if(hasInelasticData)
|
||||
{
|
||||
ifstream aDataSet(aName, ios::in);
|
||||
aDataSet >> dummy >> dummy >> total;
|
||||
inelasticData.Init(aDataSet, total, eV);
|
||||
}
|
||||
base1 = base + "/Capture/";
|
||||
G4bool hasCaptureData = false;
|
||||
dataUsed = theNames.GetName(A, Z, base1, rest, hasCaptureData);
|
||||
aName = dataUsed.GetName();
|
||||
G4NeutronHPVector captureData;
|
||||
if(hasCaptureData)
|
||||
{
|
||||
ifstream aDataSet(aName, ios::in);
|
||||
aDataSet >> dummy >> dummy >> total;
|
||||
captureData.Init(aDataSet, total, eV);
|
||||
}
|
||||
base1 = base + "/Elastic/";
|
||||
G4bool hasElasticData = false;
|
||||
dataUsed = theNames.GetName(A, Z, base1, rest, hasElasticData);
|
||||
aName = dataUsed.GetName();
|
||||
G4NeutronHPVector elasticData;
|
||||
if(hasElasticData)
|
||||
{
|
||||
ifstream aDataSet(aName, ios::in);
|
||||
aDataSet >> dummy >> dummy >> total;
|
||||
elasticData.Init(aDataSet, total, eV);
|
||||
}
|
||||
base1 = base + "/Fission/";
|
||||
G4bool hasFissionData = false;
|
||||
if(Z>=91)
|
||||
{
|
||||
dataUsed = theNames.GetName(A, Z, base1, rest, hasFissionData);
|
||||
aName = dataUsed.GetName();
|
||||
}
|
||||
G4NeutronHPVector fissionData;
|
||||
if(hasFissionData)
|
||||
{
|
||||
ifstream aDataSet(aName, ios::in);
|
||||
aDataSet >> dummy >> dummy >> total;
|
||||
fissionData.Init(aDataSet, total, eV);
|
||||
}
|
||||
hasData = hasFissionData||hasInelasticData||hasElasticData||hasCaptureData;
|
||||
G4NeutronHPVector merged, merged1;
|
||||
if(hasData)
|
||||
{
|
||||
if(hasFissionData&&hasInelasticData)
|
||||
{
|
||||
merged = fissionData + inelasticData;
|
||||
}
|
||||
else if(hasFissionData)
|
||||
{
|
||||
merged = fissionData;
|
||||
}
|
||||
else if(hasInelasticData)
|
||||
{
|
||||
merged = inelasticData;
|
||||
}
|
||||
|
||||
if(hasElasticData&&hasCaptureData)
|
||||
{
|
||||
merged1=elasticData + captureData;
|
||||
}
|
||||
else if(hasCaptureData)
|
||||
{
|
||||
merged1 = captureData;
|
||||
}
|
||||
else if(hasElasticData)
|
||||
{
|
||||
merged1 = elasticData;
|
||||
}
|
||||
|
||||
if((hasElasticData||hasCaptureData)&&(hasFissionData||hasInelasticData))
|
||||
{
|
||||
theCrossSection = merged + merged1;
|
||||
}
|
||||
else if(hasElasticData||hasCaptureData)
|
||||
{
|
||||
theCrossSection = merged1;
|
||||
}
|
||||
else if(hasFissionData||hasInelasticData)
|
||||
{
|
||||
theCrossSection = merged;
|
||||
}
|
||||
theCrossSection.Times(frac);
|
||||
}
|
||||
// theCrossSection.Dump();
|
||||
|
||||
// now isotope-production cross-sections
|
||||
theNames.SetMaxOffSet(1);
|
||||
rest = "/CrossSection/";
|
||||
base1 = base + "/IsotopeProduction/";
|
||||
G4bool hasIsotopeProductionData;
|
||||
dataUsed = theNames.GetName(A, Z, base1, rest, hasIsotopeProductionData);
|
||||
aName = dataUsed.GetName();
|
||||
if(hasIsotopeProductionData)
|
||||
{
|
||||
ifstream aDataSet(aName, ios::in);
|
||||
aDataSet>>theNumberOfProducts;
|
||||
theProductionData = new G4NeutronIsoProdCrossSections * [theNumberOfProducts];
|
||||
for(G4int i=0; i<theNumberOfProducts; i++)
|
||||
{
|
||||
G4String aName;
|
||||
aDataSet >> aName;
|
||||
aDataSet >> dummy >> dummy;
|
||||
theProductionData[i] = new G4NeutronIsoProdCrossSections(aName);
|
||||
theProductionData[i]->Init(aDataSet);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
hasData = false;
|
||||
}
|
||||
G4NeutronInelasticCrossSection theParametrization;
|
||||
G4double lastEnergy = theCrossSection.GetX(theCrossSection.GetVectorLength()-1);
|
||||
G4double lastValue = theCrossSection.GetY(theCrossSection.GetVectorLength()-1);
|
||||
G4double norm = theParametrization.GetCrossSection(lastEnergy, A, Z);
|
||||
G4double increment = 1*MeV;
|
||||
while(lastEnergy+increment<101*MeV)
|
||||
{
|
||||
G4double currentEnergy = lastEnergy+increment;
|
||||
G4double value = theParametrization.GetCrossSection(currentEnergy, A, Z)*(lastValue/norm);
|
||||
G4int position = theCrossSection.GetVectorLength();
|
||||
theCrossSection.SetData(position, currentEnergy, value);
|
||||
increment+=1*MeV;
|
||||
}
|
||||
}
|
||||
|
||||
G4double G4NeutronIsoIsoCrossSections::
|
||||
GetCrossSection(G4double anEnergy)
|
||||
{
|
||||
G4double result;
|
||||
result = theCrossSection.GetY(anEnergy);
|
||||
return result;
|
||||
}
|
||||
|
||||
G4String G4NeutronIsoIsoCrossSections::
|
||||
GetProductIsotope(G4double anEnergy)
|
||||
{
|
||||
G4String result = "UNCHANGED";
|
||||
|
||||
G4double totalXSec = theCrossSection.GetY(anEnergy);
|
||||
if(totalXSec==0) return result;
|
||||
|
||||
// now do the isotope changing reactions
|
||||
G4double * xSec = new G4double[theNumberOfProducts];
|
||||
G4double sum = 0;
|
||||
{
|
||||
for(G4int i=0; i<theNumberOfProducts; i++)
|
||||
{
|
||||
xSec[i] = theProductionData[i]->GetProductionCrossSection(anEnergy);
|
||||
sum += xSec[i];
|
||||
}
|
||||
}
|
||||
G4double isoChangeXsec = sum;
|
||||
G4double rand = G4UniformRand();
|
||||
if(rand > isoChangeXsec/totalXSec)
|
||||
{
|
||||
delete [] xSec;
|
||||
return result;
|
||||
}
|
||||
G4double random = G4UniformRand();
|
||||
G4double running = 0;
|
||||
G4int index;
|
||||
{
|
||||
for(G4int i=0; i<theNumberOfProducts; i++)
|
||||
{
|
||||
running += xSec[i];
|
||||
index = i;
|
||||
if(random<=running/sum) break;
|
||||
}
|
||||
}
|
||||
delete [] xSec;
|
||||
result = theProductionData[index]->GetProductIsotope();
|
||||
|
||||
return result;
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
#include "G4NeutronIsoProdCrossSections.hh"
|
||||
|
||||
void G4NeutronIsoProdCrossSections::
|
||||
Init(ifstream & aDataSet)
|
||||
{
|
||||
G4int aNumberOfPoints;
|
||||
aDataSet>>aNumberOfPoints;
|
||||
theProductionCrossSections.Init(aDataSet, aNumberOfPoints, eV);
|
||||
}
|
||||
|
||||
G4double G4NeutronIsoProdCrossSections::
|
||||
GetProductionCrossSection(G4double anEnergy)
|
||||
{
|
||||
G4double result;
|
||||
result = theProductionCrossSections.GetY(anEnergy);
|
||||
return result;
|
||||
}
|
||||
|
||||
G4String G4NeutronIsoProdCrossSections::
|
||||
GetProductIsotope()
|
||||
{
|
||||
return theProductName;
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
#include "G4NeutronIsotopeProduction.hh"
|
||||
|
||||
G4NeutronIsotopeProduction::
|
||||
G4NeutronIsotopeProduction()
|
||||
{
|
||||
numberOfElements = G4Element::GetNumberOfElements();
|
||||
theData = new G4NeutronElementIsoCrossSections * [numberOfElements];
|
||||
for(G4int i=0; i< numberOfElements; i++)
|
||||
{
|
||||
theData[i] = new G4NeutronElementIsoCrossSections;
|
||||
if((*(G4Element::GetElementTable()))(i)->GetZ()>12 &&
|
||||
(*(G4Element::GetElementTable()))(i)->GetZ()<84) // @@@@@@ workaround to ne fixed in G4NeutronHPNames.
|
||||
{
|
||||
theData[i]->Init((*(G4Element::GetElementTable()))(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
G4NeutronIsotopeProduction::
|
||||
~G4NeutronIsotopeProduction()
|
||||
{
|
||||
for(G4int i=0; i<numberOfElements; i++)
|
||||
{
|
||||
delete theData[i];
|
||||
}
|
||||
if(theData!=NULL) delete [] theData;
|
||||
}
|
||||
|
||||
|
||||
G4IsoResult * G4NeutronIsotopeProduction::
|
||||
GetIsotope(const G4Track& aTrack,
|
||||
const G4Nucleus & aNucleus)
|
||||
{
|
||||
// is applicable?
|
||||
if(aTrack.GetDynamicParticle()->GetDefinition() != G4Neutron::Neutron()) return NULL;
|
||||
if(aTrack.GetKineticEnergy()>100*MeV) return NULL;
|
||||
|
||||
// get the isotope
|
||||
G4Material * theMaterial = aTrack.GetMaterial();
|
||||
if(theMaterial->GetZ()<13) return NULL; //@@@@@@ workaround to ne fixed in G4NeutronHPNames.
|
||||
if(theMaterial->GetZ()>83) return NULL; //@@@@@@ workaround to ne fixed in G4NeutronHPNames.
|
||||
G4int nEleInMat = theMaterial->GetNumberOfElements();
|
||||
G4int index;
|
||||
G4double * xSec = new G4double[nEleInMat];
|
||||
G4double sum = 0;
|
||||
{
|
||||
for(G4int i=0; i<nEleInMat; i++)
|
||||
{
|
||||
index = theMaterial->GetElement(i)->GetIndex();
|
||||
xSec[i] = theData[index]->GetCrossSection(aTrack.GetKineticEnergy());
|
||||
sum += xSec[i];
|
||||
}
|
||||
}
|
||||
G4double random = G4UniformRand();
|
||||
G4double running = 0;
|
||||
{
|
||||
for(G4int i=0; i<nEleInMat; i++)
|
||||
{
|
||||
running += xSec[i];
|
||||
index = theMaterial->GetElement(i)->GetIndex();
|
||||
if(random<=running/sum) break;
|
||||
}
|
||||
}
|
||||
delete [] xSec;
|
||||
G4IsoResult * result = theData[index]->GetProductIsotope(aTrack.GetKineticEnergy());
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user