Import Geant4 8.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 14:36:02 +02:00
parent d93e1e39a9
commit 8a51e0bc40
5471 changed files with 99628 additions and 55248 deletions
@@ -111,7 +111,8 @@ GetCrossSection(const G4DynamicParticle* aP, const G4Element*anE, G4double aT)
G4int size = G4int(std::max(10., aT/60*kelvin));
G4ThreeVector neutronVelocity = 1./G4Neutron::Neutron()->GetPDGMass()*theNeutron.GetMomentum();
G4double neutronVMag = neutronVelocity.mag();
while(counter == 0 || std::abs(buffer-result/counter) > 0.03*buffer)
while(counter == 0 || std::abs(buffer-result/std::max(1,counter)) > 0.03*buffer)
{
if(counter) buffer = result/counter;
while (counter<size)
@@ -108,7 +108,8 @@ GetCrossSection(const G4DynamicParticle* aP, const G4Element*anE, G4double aT)
G4int size = G4int(std::max(10., aT/60*kelvin));
G4ThreeVector neutronVelocity = 1./G4Neutron::Neutron()->GetPDGMass()*theNeutron.GetMomentum();
G4double neutronVMag = neutronVelocity.mag();
while(counter == 0 || std::abs(buffer-result/counter) > 0.03*buffer)
while(counter == 0 || std::abs(buffer-result/std::max(1,counter)) > 0.03*buffer)
{
if(counter) buffer = result/counter;
while (counter<size)
@@ -107,7 +107,8 @@ GetCrossSection(const G4DynamicParticle* aP, const G4Element*anE, G4double aT)
G4int size = G4int(std::max(10., aT/60*kelvin));
G4ThreeVector neutronVelocity = 1./G4Neutron::Neutron()->GetPDGMass()*theNeutron.GetMomentum();
G4double neutronVMag = neutronVelocity.mag();
while(counter == 0 || std::abs(buffer-result/counter) > 0.01*buffer)
while(counter == 0 || std::abs(buffer-result/std::max(1,counter)) > 0.01*buffer)
{
if(counter) buffer = result/counter;
while (counter<size)
@@ -30,7 +30,7 @@
// and all its terms.
//
// $Id: G4NeutronHPInelastic.cc,v 1.19 2005/06/04 13:44:43 jwellisc Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
#include "G4NeutronHPInelastic.hh"
@@ -34,20 +34,27 @@
void G4NeutronHPInelasticBaseFS::InitGammas(G4double AR, G4double ZR)
{
char the[100] = {""};
std::ostrstream ost(the, 100, std::ios::out);
// char the[100] = {""};
// std::ostrstream ost(the, 100, std::ios::out);
// ost <<gammaPath<<"z"<<ZR<<".a"<<AR;
// G4String * aName = new G4String(the);
// std::ifstream from(*aName, std::ios::in);
std::ostringstream ost;
ost <<gammaPath<<"z"<<ZR<<".a"<<AR;
G4String * aName = new G4String(the);
std::ifstream from(*aName, std::ios::in);
G4String aName = ost.str();
std::ifstream from(aName, std::ios::in);
if(!from) return; // no data found for this isotope
std::ifstream theGammaData(*aName, std::ios::in);
// std::ifstream theGammaData(*aName, std::ios::in);
std::ifstream theGammaData(aName, std::ios::in);
G4double eps = 0.001;
theNuclearMassDifference =
G4NucleiPropertiesTable::GetBindingEnergy(static_cast<G4int>(ZR+eps),static_cast<G4int>(AR+eps)) -
G4NucleiPropertiesTable::GetBindingEnergy(static_cast<G4int>(theBaseZ+eps), static_cast<G4int>(theBaseA+eps));
theGammas.Init(theGammaData);
delete aName;
// delete aName;
}
void G4NeutronHPInelasticBaseFS::Init (G4double A, G4double Z, G4String & dirName, G4String & bit)
@@ -35,16 +35,23 @@
void G4NeutronHPInelasticCompFS::InitGammas(G4double AR, G4double ZR)
{
char the[100] = {""};
std::ostrstream ost(the, 100, std::ios::out);
// char the[100] = {""};
// std::ostrstream ost(the, 100, std::ios::out);
// ost <<gammaPath<<"z"<<ZR<<".a"<<AR;
// G4String * aName = new G4String(the);
// std::ifstream from(*aName, std::ios::in);
std::ostringstream ost;
ost <<gammaPath<<"z"<<ZR<<".a"<<AR;
G4String * aName = new G4String(the);
std::ifstream from(*aName, std::ios::in);
G4String aName = ost.str();
std::ifstream from(aName, std::ios::in);
if(!from) return; // no data found for this isotope
std::ifstream theGammaData(*aName, std::ios::in);
// std::ifstream theGammaData(*aName, std::ios::in);
std::ifstream theGammaData(aName, std::ios::in);
theGammas.Init(theGammaData);
delete aName;
// delete aName;
}
void G4NeutronHPInelasticCompFS::Init (G4double A, G4double Z, G4String & dirName, G4String & aFSType)
@@ -106,7 +106,8 @@ GetCrossSection(const G4DynamicParticle* aP, const G4Element*anE, G4double aT)
G4int size = G4int(std::max(10., aT/60*kelvin));
G4ThreeVector neutronVelocity = 1./G4Neutron::Neutron()->GetPDGMass()*theNeutron.GetMomentum();
G4double neutronVMag = neutronVelocity.mag();
while(counter == 0 || std::abs(buffer-result/counter) > 0.01*buffer)
while(counter == 0 || std::abs(buffer-result/std::max(1,counter)) > 0.01*buffer)
{
if(counter) buffer = result/counter;
while (counter<size)
@@ -22,7 +22,7 @@
//
//
// $Id: G4NeutronHPNBodyPhaseSpace.cc,v 1.12 2005/06/04 13:44:43 jwellisc Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
#include "G4NeutronHPNBodyPhaseSpace.hh"
#include "G4Gamma.hh"
@@ -31,7 +31,7 @@
#include "G4Gamma.hh"
#include "G4ios.hh"
#include <fstream>
#include <strstream>
// #include <strstream>
void G4NeutronHPNInelasticFS::Init (G4double A, G4double Z, G4String & dirName, G4String & aFSType)
{
@@ -0,0 +1,139 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of 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. *
// ********************************************************************
//
//
// 05-11-21 NeutronHP or Low Energy Parameterization Models
// Implemented by T. Koi (SLAC/SCCS)
// If NeutronHP data do not available for an element, then Low Energy
// Parameterization models handle the interactions of the element.
//
// neutron_hp -- source file
// J.P. Wellisch, Nov-1996
// A prototype of the low energy neutron transport model.
//
#include "G4NeutronHPorLCapture.hh"
#include "G4NeutronHPCaptureFS.hh"
G4NeutronHPorLCapture::G4NeutronHPorLCapture()
{
G4NeutronHPCaptureFS * theFS = new G4NeutronHPCaptureFS;
if(!getenv("NeutronHPCrossSections"))
throw G4HadronicException(__FILE__, __LINE__, "Please setenv NeutronHPCrossSections to point to the neutron cross-section files.");
dirName = getenv("NeutronHPCrossSections");
G4String tString = "/Capture/";
dirName = dirName + tString;
// G4cout <<"G4NeutronHPorLCapture::G4NeutronHPorLCapture testit "<<dirName<<G4endl;
numEle = G4Element::GetNumberOfElements();
theCapture = new G4NeutronHPChannel[numEle];
unavailable_elements.clear();
for (G4int i=0; i<numEle; i++)
{
theCapture[i].Init((*(G4Element::GetElementTable()))[i], dirName);
//G4cout << (*(G4Element::GetElementTable()))[i] -> GetName() << G4endl;
//while(!theCapture[i].Register(theFS));
try { while(!theCapture[i].Register(theFS)); }
catch ( G4HadronicException )
{
unavailable_elements.insert ( (*(G4Element::GetElementTable()))[i]->GetName() );
}
}
delete theFS;
SetMinEnergy(0.*eV);
SetMaxEnergy(20.*MeV);
if ( unavailable_elements.size() > 0 )
{
std::set< G4String>::iterator it;
G4cout << "HP Capture data are not available for thess elements "<< G4endl;
for ( it = unavailable_elements.begin() ; it != unavailable_elements.end() ; it++ )
G4cout << *it << G4endl;
G4cout << "Low Energy Parameterization Models will be used."<< G4endl;
}
createXSectionDataSet();
}
G4NeutronHPorLCapture::~G4NeutronHPorLCapture()
{
delete [] theCapture;
delete theDataSet;
}
#include "G4NeutronHPThermalBoost.hh"
G4HadFinalState * G4NeutronHPorLCapture::ApplyYourself(const G4HadProjectile& aTrack, G4Nucleus& )
{
const G4Material * theMaterial = aTrack.GetMaterial();
G4int n = theMaterial->GetNumberOfElements();
G4int index = theMaterial->GetElement(0)->GetIndex();
if(n!=1)
{
G4int i;
xSec = new G4double[n];
G4double sum=0;
const G4double * NumAtomsPerVolume = theMaterial->GetVecNbOfAtomsPerVolume();
G4double rWeight;
G4NeutronHPThermalBoost aThermalE;
for (i=0; i<n; i++)
{
index = theMaterial->GetElement(i)->GetIndex();
rWeight = NumAtomsPerVolume[i];
G4double x = aThermalE.GetThermalEnergy(aTrack, theMaterial->GetElement(i), theMaterial->GetTemperature());
//xSec[i] = theCapture[index].GetXsec(aThermalE.GetThermalEnergy(aTrack,
// theMaterial->GetElement(i),
// theMaterial->GetTemperature()));
xSec[i] = theCapture[index].GetXsec(x);
xSec[i] *= rWeight;
sum+=xSec[i];
}
G4double random = G4UniformRand();
G4double running = 0;
for (i=0; i<n; i++)
{
running += xSec[i];
index = theMaterial->GetElement(i)->GetIndex();
if(random<=running/sum) break;
}
delete [] xSec;
// it is element-wise initialised.
}
return theCapture[index].ApplyYourself(aTrack);
}
G4bool G4NeutronHPorLCapture::IsThisElementOK( G4String name )
{
if ( unavailable_elements.find( name ) == unavailable_elements.end() )
return TRUE;
else
return FALSE;
}
void G4NeutronHPorLCapture::createXSectionDataSet()
{
theDataSet = new G4NeutronHPorLCaptureData ( theCapture , &unavailable_elements );
}
@@ -0,0 +1,145 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of 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. *
// ********************************************************************
//
//
// 05-11-21 NeutronHP or Low Energy Parameterization Models
// Implemented by T. Koi (SLAC/SCCS)
// If NeutronHP data do not available for an element, then Low Energy
// Parameterization models handle the interactions of the element.
//
#include "G4NeutronHPorLCaptureData.hh"
#include "G4Neutron.hh"
#include "G4ElementTable.hh"
#include "G4NeutronHPData.hh"
#include "G4PhysicsVector.hh"
G4NeutronHPorLCaptureData::G4NeutronHPorLCaptureData( G4NeutronHPChannel* pChannel , std::set< G4String >* pSet )
{
theCaptureChannel = pChannel;
unavailable_elements = pSet;
}
G4bool G4NeutronHPorLCaptureData::IsApplicable(const G4DynamicParticle*aP, const G4Element* anElement)
{
G4bool result = true;
G4double eKin = aP->GetKineticEnergy();
if(eKin>20*MeV||aP->GetDefinition()!=G4Neutron::Neutron()) result = false;
if ( unavailable_elements->find( anElement->GetName() ) != unavailable_elements->end() ) result = false;
return result;
}
G4NeutronHPorLCaptureData::G4NeutronHPorLCaptureData()
{
// BuildPhysicsTable(*G4Neutron::Neutron());
}
G4NeutronHPorLCaptureData::~G4NeutronHPorLCaptureData()
{
// delete theCrossSections;
}
void G4NeutronHPorLCaptureData::BuildPhysicsTable( const G4ParticleDefinition& aP )
{
if( &aP!=G4Neutron::Neutron() )
throw G4HadronicException(__FILE__, __LINE__, "Attempt to use NeutronHP data for particles other than neutrons!!!");
}
void G4NeutronHPorLCaptureData::DumpPhysicsTable(const G4ParticleDefinition& aP)
{
if(&aP!=G4Neutron::Neutron())
throw G4HadronicException(__FILE__, __LINE__, "Attempt to use NeutronHP data for particles other than neutrons!!!");
// G4cout << "G4NeutronHPorLCaptureData::DumpPhysicsTable still to be implemented"<<G4endl;
}
#include "G4Nucleus.hh"
#include "G4NucleiPropertiesTable.hh"
#include "G4Neutron.hh"
#include "G4Electron.hh"
G4double G4NeutronHPorLCaptureData::
GetCrossSection(const G4DynamicParticle* aP, const G4Element*anE, G4double aT)
{
// G4cout << "Choice G4NeutronHPorLCaptureData for element " << anE->GetName() << G4endl;
G4double result = 0;
// G4bool outOfRange;
G4int index = anE->GetIndex();
// prepare neutron
G4double eKinetic = aP->GetKineticEnergy();
G4ReactionProduct theNeutron( aP->GetDefinition() );
theNeutron.SetMomentum( aP->GetMomentum() );
theNeutron.SetKineticEnergy( eKinetic );
// prepare thermal nucleus
G4Nucleus aNuc;
G4double eps = 0.0001;
G4double theA = anE->GetN();
G4double theZ = anE->GetZ();
G4double eleMass;
eleMass = ( G4NucleiPropertiesTable::GetNuclearMass(static_cast<G4int>(theZ+eps), static_cast<G4int>(theA+eps))
) / G4Neutron::Neutron()->GetPDGMass();
G4ReactionProduct boosted;
G4double aXsection;
// MC integration loop
G4int counter = 0;
G4double buffer = 0;
G4int size = G4int(std::max(10., aT/60*kelvin));
G4ThreeVector neutronVelocity = 1./G4Neutron::Neutron()->GetPDGMass()*theNeutron.GetMomentum();
G4double neutronVMag = neutronVelocity.mag();
while(counter == 0 || std::abs(buffer-result/std::max(1,counter)) > 0.03*buffer)
{
if(counter) buffer = result/counter;
while (counter<size)
{
counter ++;
G4ReactionProduct aThermalNuc = aNuc.GetThermalNucleus(eleMass, aT);
boosted.Lorentz(theNeutron, aThermalNuc);
G4double theEkin = boosted.GetKineticEnergy();
//aXsection = (*((*theCrossSections)(index))).GetValue(theEkin, outOfRange);
aXsection = theCaptureChannel[index].GetXsec( theEkin );
// velocity correction.
G4ThreeVector targetVelocity = 1./aThermalNuc.GetMass()*aThermalNuc.GetMomentum();
aXsection *= (targetVelocity-neutronVelocity).mag()/neutronVMag;
result += aXsection;
}
size += size;
}
result /= counter;
return result;
}
@@ -0,0 +1,67 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of 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. *
// ********************************************************************
//
//
// 05-11-21 NeutronHP or Low Energy Parameterization Models
// Implemented by T. Koi (SLAC/SCCS)
// If NeutronHP data do not available for an element, then Low Energy
// Parameterization models handle the interactions of the element.
//
#include "G4NeutronHPorLCaptureModel.hh"
G4NeutronHPorLCaptureModel::G4NeutronHPorLCaptureModel()
{
theHPCapture = new G4NeutronHPorLCapture();
theLCapture = new G4LCapture();
theHPNames = new G4NeutronHPNames();
}
G4NeutronHPorLCaptureModel::~G4NeutronHPorLCaptureModel()
{
delete theHPCapture;
delete theLCapture;
delete theHPNames;
}
G4HadFinalState* G4NeutronHPorLCaptureModel::ApplyYourself(const G4HadProjectile& aTrack, G4Nucleus& aTargetNucleus)
{
if ( aTrack.GetKineticEnergy() > 20*MeV )
{
//G4cout << "Select LE model " << G4endl;
return theLCapture->ApplyYourself( aTrack , aTargetNucleus );
}
G4int Z = (G4int)(aTargetNucleus.GetZ()+0.5);
G4String theNameOfElement = theHPNames->GetName( Z-1 ); // GetName(0) reply "Hydrogen"
if ( theHPCapture->IsThisElementOK( theNameOfElement ) )
{
//G4cout << "Select HP model " << G4endl;
return theHPCapture->ApplyYourself( aTrack , aTargetNucleus );
}
else
{
//G4cout << "Select LE model " << G4endl;
return theLCapture->ApplyYourself( aTrack , aTargetNucleus );
}
}
@@ -0,0 +1,188 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of 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. *
// ********************************************************************
//
//
// 05-11-21 NeutronHP or Low Energy Parameterization Models
// Implemented by T. Koi (SLAC/SCCS)
// If NeutronHP data do not available for an element, then Low Energy
// Parameterization models handle the interactions of the element.
//
// neutron_hp -- source file
// J.P. Wellisch, Nov-1996
// A prototype of the low energy neutron transport model.
//
#include "G4NeutronHPorLEInelastic.hh"
//#include "G4NeutronHPInelasticFS.hh"
G4NeutronHPorLEInelastic::G4NeutronHPorLEInelastic()
{
SetMinEnergy(0.*eV);
SetMaxEnergy(20.*MeV);
// G4NeutronHPInelasticFS * theFS = new G4NeutronHPInelasticFS;
if(!getenv("NeutronHPCrossSections"))
throw G4HadronicException(__FILE__, __LINE__, "Please setenv NeutronHPCrossSections to point to the neutron cross-section files.");
dirName = getenv("NeutronHPCrossSections");
G4String tString = "/Inelastic/";
dirName = dirName + tString;
// G4cout <<"G4NeutronHPorLEInelastic::G4NeutronHPorLEInelastic testit "<<dirName<<G4endl;
numEle = G4Element::GetNumberOfElements();
theInelastic = new G4NeutronHPChannelList[numEle];
unavailable_elements.clear();
for (G4int i=0; i<numEle; i++)
{
theInelastic[i].Init( (*(G4Element::GetElementTable()))[i] , dirName );
do
{
try
{
theInelastic[i].Register(&theNFS, "F01"); // has
theInelastic[i].Register(&theNXFS, "F02");
theInelastic[i].Register(&the2NDFS, "F03");
theInelastic[i].Register(&the2NFS, "F04"); // has, E Done
theInelastic[i].Register(&the3NFS, "F05"); // has, E Done
theInelastic[i].Register(&theNAFS, "F06");
theInelastic[i].Register(&theN3AFS, "F07");
theInelastic[i].Register(&the2NAFS, "F08");
theInelastic[i].Register(&the3NAFS, "F09");
theInelastic[i].Register(&theNPFS, "F10");
theInelastic[i].Register(&theN2AFS, "F11");
theInelastic[i].Register(&the2N2AFS, "F12");
theInelastic[i].Register(&theNDFS, "F13");
theInelastic[i].Register(&theNTFS, "F14");
theInelastic[i].Register(&theNHe3FS, "F15");
theInelastic[i].Register(&theND2AFS, "F16");
theInelastic[i].Register(&theNT2AFS, "F17");
theInelastic[i].Register(&the4NFS, "F18"); // has, E Done
theInelastic[i].Register(&the2NPFS, "F19");
theInelastic[i].Register(&the3NPFS, "F20");
theInelastic[i].Register(&theN2PFS, "F21");
theInelastic[i].Register(&theNPAFS, "F22");
theInelastic[i].Register(&thePFS, "F23");
theInelastic[i].Register(&theDFS, "F24");
theInelastic[i].Register(&theTFS, "F25");
theInelastic[i].Register(&theHe3FS, "F26");
theInelastic[i].Register(&theAFS, "F27");
theInelastic[i].Register(&the2AFS, "F28");
theInelastic[i].Register(&the3AFS, "F29");
theInelastic[i].Register(&the2PFS, "F30");
theInelastic[i].Register(&thePAFS, "F31");
theInelastic[i].Register(&theD2AFS, "F32");
theInelastic[i].Register(&theT2AFS, "F33");
theInelastic[i].Register(&thePDFS, "F34");
theInelastic[i].Register(&thePTFS, "F35");
theInelastic[i].Register(&theDAFS, "F36");
}
catch ( G4HadronicException )
{
unavailable_elements.insert ( (*(G4Element::GetElementTable()))[i]->GetName() );
}
theInelastic[i].RestartRegistration();
}
while( !theInelastic[i].HasDataInAnyFinalState());
}
// delete theFS;
if ( unavailable_elements.size() > 0 )
{
std::set< G4String>::iterator it;
G4cout << "HP Inelastic data are not available for thess elements "<< G4endl;
for ( it = unavailable_elements.begin() ; it != unavailable_elements.end() ; it++ )
G4cout << *it << G4endl;
G4cout << "Low Energy Parameterization Models will be used."<< G4endl;
}
createXSectionDataSet();
}
G4NeutronHPorLEInelastic::~G4NeutronHPorLEInelastic()
{
delete [] theInelastic;
delete theDataSet;
}
#include "G4NeutronHPThermalBoost.hh"
G4HadFinalState * G4NeutronHPorLEInelastic::ApplyYourself(const G4HadProjectile& aTrack, G4Nucleus& )
{
G4int it=0;
const G4Material * theMaterial = aTrack.GetMaterial();
G4int n = theMaterial->GetNumberOfElements();
G4int index = theMaterial->GetElement(0)->GetIndex();
if(n!=1)
{
G4int i;
xSec = new G4double[n];
G4double sum=0;
const G4double * NumAtomsPerVolume = theMaterial->GetVecNbOfAtomsPerVolume();
G4double rWeight;
G4NeutronHPThermalBoost aThermalE;
for (i=0; i<n; i++)
{
index = theMaterial->GetElement(i)->GetIndex();
rWeight = NumAtomsPerVolume[i];
G4double x = aThermalE.GetThermalEnergy(aTrack, theMaterial->GetElement(i), theMaterial->GetTemperature());
//xSec[i] = theInelastic[index].GetXsec(aThermalE.GetThermalEnergy(aTrack,
// theMaterial->GetElement(i),
// theMaterial->GetTemperature()));
xSec[i] = theInelastic[index].GetXsec(x);
xSec[i] *= rWeight;
sum+=xSec[i];
}
G4double random = G4UniformRand();
G4double running = 0;
for (i=0; i<n; i++)
{
running += xSec[i];
index = theMaterial->GetElement(i)->GetIndex();
it = i;
if(random<=running/sum) break;
}
delete [] xSec;
// it is element-wise initialised.
}
//return theInelastic[index].ApplyYourself(aTrack);
return theInelastic[index].ApplyYourself( theMaterial->GetElement(it) , aTrack );
}
G4bool G4NeutronHPorLEInelastic::IsThisElementOK( G4String name )
{
if ( unavailable_elements.find( name ) == unavailable_elements.end() )
return TRUE;
else
return FALSE;
}
void G4NeutronHPorLEInelastic::createXSectionDataSet()
{
theDataSet = new G4NeutronHPorLEInelasticData ( theInelastic , &unavailable_elements );
}
@@ -0,0 +1,190 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of 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. *
// ********************************************************************
//
//
// 05-11-21 NeutronHP or Low Energy Parameterization Models
// Implemented by T. Koi (SLAC/SCCS)
// If NeutronHP data do not available for an element, then Low Energy
// Parameterization models handle the interactions of the element.
//
#include "G4NeutronHPorLEInelasticData.hh"
#include "G4Neutron.hh"
#include "G4ElementTable.hh"
#include "G4NeutronHPData.hh"
#include "G4PhysicsVector.hh"
G4NeutronHPorLEInelasticData::G4NeutronHPorLEInelasticData( G4NeutronHPChannelList* pChannel , std::set< G4String >* pSet )
{
theInelasticChannel = pChannel;
unavailable_elements = pSet;
BuildPhysicsTable(*G4Neutron::Neutron());
}
G4bool G4NeutronHPorLEInelasticData::IsApplicable(const G4DynamicParticle*aP, const G4Element* anElement)
{
G4bool result = true;
G4double eKin = aP->GetKineticEnergy();
if(eKin>20*MeV||aP->GetDefinition()!=G4Neutron::Neutron()) result = false;
if ( unavailable_elements->find( anElement->GetName() ) != unavailable_elements->end() ) result = false;
return result;
}
G4NeutronHPorLEInelasticData::G4NeutronHPorLEInelasticData()
{
// BuildPhysicsTable(*G4Neutron::Neutron());
}
G4NeutronHPorLEInelasticData::~G4NeutronHPorLEInelasticData()
{
// delete theCrossSections;
}
#include "G4NeutronHPInelasticData.hh"
#include "G4LPhysicsFreeVector.hh"
//#include "G4NeutronHPElementData.hh"
void G4NeutronHPorLEInelasticData::BuildPhysicsTable( const G4ParticleDefinition& aP )
{
if( &aP!=G4Neutron::Neutron() )
throw G4HadronicException(__FILE__, __LINE__, "Attempt to use NeutronHP data for particles other than neutrons!!!");
size_t numberOfElements = G4Element::GetNumberOfElements();
theCrossSections = new G4PhysicsTable( numberOfElements );
static const G4ElementTable *theElementTable = G4Element::GetElementTable();
for ( size_t i=0 ; i < numberOfElements; ++i )
{
G4PhysicsVector* thePhysVec = new G4LPhysicsFreeVector(0, 0, 0);
if ( unavailable_elements->find( (*theElementTable)[i]->GetName() ) == unavailable_elements->end() )
{
G4NeutronHPElementData* theElementData = new G4NeutronHPElementData();
theElementData->Init( (*theElementTable)[i] );
G4NeutronHPVector* theHPVector = theElementData->GetData( (G4NeutronHPInelasticData*)this );
G4int len = theHPVector->GetVectorLength();
if ( len!=0 )
{
G4double emin = theHPVector->GetX(0);
G4double emax = theHPVector->GetX(len-1);
G4LPhysicsFreeVector* aPhysVector= new G4LPhysicsFreeVector ( len , emin , emax );
for ( G4int i=0; i<len; i++ )
{
aPhysVector->PutValues( i , theHPVector->GetX(i) , theHPVector->GetY(i) );
}
delete thePhysVec;
thePhysVec = aPhysVector;
}
//G4PhysicsVector* physVec = G4NeutronHPData::
//Instance()->MakePhysicsVector((*theElementTable)[i], this);
//theCrossSections->push_back(physVec);
}
theCrossSections->push_back(thePhysVec);
}
}
void G4NeutronHPorLEInelasticData::DumpPhysicsTable(const G4ParticleDefinition& aP)
{
if(&aP!=G4Neutron::Neutron())
throw G4HadronicException(__FILE__, __LINE__, "Attempt to use NeutronHP data for particles other than neutrons!!!");
// G4cout << "G4NeutronHPorLEInelasticData::DumpPhysicsTable still to be implemented"<<G4endl;
}
#include "G4Nucleus.hh"
#include "G4NucleiPropertiesTable.hh"
#include "G4Neutron.hh"
#include "G4Electron.hh"
G4double G4NeutronHPorLEInelasticData::
GetCrossSection(const G4DynamicParticle* aP, const G4Element*anE, G4double aT)
{
// G4cout << "Choice G4NeutronHPorLEInelasticData for element " << anE->GetName() << G4endl;
G4double result = 0;
//G4bool outOfRange;
G4int index = anE->GetIndex();
// prepare neutron
G4double eKinetic = aP->GetKineticEnergy();
G4ReactionProduct theNeutron( aP->GetDefinition() );
theNeutron.SetMomentum( aP->GetMomentum() );
theNeutron.SetKineticEnergy( eKinetic );
// prepare thermal nucleus
G4Nucleus aNuc;
G4double eps = 0.0001;
G4double theA = anE->GetN();
G4double theZ = anE->GetZ();
G4double eleMass;
eleMass = ( G4NucleiPropertiesTable::GetNuclearMass(static_cast<G4int>(theZ+eps), static_cast<G4int>(theA+eps))
) / G4Neutron::Neutron()->GetPDGMass();
G4ReactionProduct boosted;
G4double aXsection;
// MC integration loop
G4int counter = 0;
G4double buffer = 0;
G4int size = G4int(std::max(10., aT/60*kelvin));
G4ThreeVector neutronVelocity = 1./G4Neutron::Neutron()->GetPDGMass()*theNeutron.GetMomentum();
G4double neutronVMag = neutronVelocity.mag();
while(counter == 0 || std::abs(buffer-result/std::max(1,counter)) > 0.03*buffer)
{
if(counter) buffer = result/counter;
while (counter<size)
{
counter ++;
G4ReactionProduct aThermalNuc = aNuc.GetThermalNucleus(eleMass, aT);
boosted.Lorentz(theNeutron, aThermalNuc);
G4double theEkin = boosted.GetKineticEnergy();
//aXsection = (*((*theCrossSections)(index))).GetValue(theEkin, outOfRange);
aXsection = theInelasticChannel[index].GetXsec( theEkin );
// velocity correction.
G4ThreeVector targetVelocity = 1./aThermalNuc.GetMass()*aThermalNuc.GetMomentum();
aXsection *= (targetVelocity-neutronVelocity).mag()/neutronVMag;
result += aXsection;
}
size += size;
}
result /= counter;
//return result;
return result*barn;
}
@@ -0,0 +1,68 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of 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. *
// ********************************************************************
//
//
// 05-11-21 NeutronHP or Low Energy Parameterization Models
// Implemented by T. Koi (SLAC/SCCS)
// If NeutronHP data do not available for an element, then Low Energy
// Parameterization models handle the interactions of the element.
//
#include "G4NeutronHPorLEInelasticModel.hh"
G4NeutronHPorLEInelasticModel::G4NeutronHPorLEInelasticModel()
{
//theHPElastic = new G4NeutronHPElastic();
theHPInelastic = new G4NeutronHPorLEInelastic();
theLEInelastic = new G4LENeutronInelastic();
theHPNames = new G4NeutronHPNames();
}
G4NeutronHPorLEInelasticModel::~G4NeutronHPorLEInelasticModel()
{
delete theHPInelastic;
delete theLEInelastic;
delete theHPNames;
}
G4HadFinalState* G4NeutronHPorLEInelasticModel::ApplyYourself(const G4HadProjectile& aTrack, G4Nucleus& aTargetNucleus)
{
if ( aTrack.GetKineticEnergy() > 20*MeV )
{
//G4cout << "Select LE model " << G4endl;
return theLEInelastic->ApplyYourself( aTrack , aTargetNucleus );
}
G4int Z = (G4int)(aTargetNucleus.GetZ()+0.5);
G4String theNameOfElement = theHPNames->GetName( Z-1 ); // GetName(0) reply "Hydrogen"
if ( theHPInelastic->IsThisElementOK( theNameOfElement ) )
{
//G4cout << "Select HP model " << G4endl;
return theHPInelastic->ApplyYourself( aTrack , aTargetNucleus );
}
else
{
//G4cout << "Select LE model " << G4endl;
return theLEInelastic->ApplyYourself( aTrack , aTargetNucleus );
}
}
@@ -0,0 +1,138 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of 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. *
// ********************************************************************
//
//
// 05-11-21 NeutronHP or Low Energy Parameterization Models
// Implemented by T. Koi (SLAC/SCCS)
// If NeutronHP data do not available for an element, then Low Energy
// Parameterization models handle the interactions of the element.
//
// neutron_hp -- source file
// J.P. Wellisch, Nov-1996
// A prototype of the low energy neutron transport model.
//
#include "G4NeutronHPorLElastic.hh"
#include "G4NeutronHPElasticFS.hh"
G4NeutronHPorLElastic::G4NeutronHPorLElastic()
{
G4NeutronHPElasticFS * theFS = new G4NeutronHPElasticFS;
if(!getenv("NeutronHPCrossSections"))
throw G4HadronicException(__FILE__, __LINE__, "Please setenv NeutronHPCrossSections to point to the neutron cross-section files.");
dirName = getenv("NeutronHPCrossSections");
G4String tString = "/Elastic/";
dirName = dirName + tString;
// G4cout <<"G4NeutronHPorLElastic::G4NeutronHPorLElastic testit "<<dirName<<G4endl;
numEle = G4Element::GetNumberOfElements();
theElastic = new G4NeutronHPChannel[numEle];
unavailable_elements.clear();
for (G4int i=0; i<numEle; i++)
{
theElastic[i].Init((*(G4Element::GetElementTable()))[i], dirName);
//while(!theElastic[i].Register(theFS));
try { while(!theElastic[i].Register(theFS)); }
catch ( G4HadronicException )
{
unavailable_elements.insert ( (*(G4Element::GetElementTable()))[i]->GetName() );
}
}
delete theFS;
SetMinEnergy(0.*eV);
SetMaxEnergy(20.*MeV);
if ( unavailable_elements.size() > 0 )
{
std::set< G4String>::iterator it;
G4cout << "HP Elastic data are not available for thess elements "<< G4endl;
for ( it = unavailable_elements.begin() ; it != unavailable_elements.end() ; it++ )
G4cout << *it << G4endl;
G4cout << "Low Energy Parameterization Models will be used."<< G4endl;
}
createXSectionDataSet();
}
G4NeutronHPorLElastic::~G4NeutronHPorLElastic()
{
delete [] theElastic;
delete theDataSet;
}
#include "G4NeutronHPThermalBoost.hh"
G4HadFinalState * G4NeutronHPorLElastic::ApplyYourself(const G4HadProjectile& aTrack, G4Nucleus& )
{
const G4Material * theMaterial = aTrack.GetMaterial();
G4int n = theMaterial->GetNumberOfElements();
G4int index = theMaterial->GetElement(0)->GetIndex();
if(n!=1)
{
G4int i;
xSec = new G4double[n];
G4double sum=0;
const G4double * NumAtomsPerVolume = theMaterial->GetVecNbOfAtomsPerVolume();
G4double rWeight;
G4NeutronHPThermalBoost aThermalE;
for (i=0; i<n; i++)
{
index = theMaterial->GetElement(i)->GetIndex();
rWeight = NumAtomsPerVolume[i];
G4double x = aThermalE.GetThermalEnergy(aTrack, theMaterial->GetElement(i), theMaterial->GetTemperature());
//xSec[i] = theElastic[index].GetXsec(aThermalE.GetThermalEnergy(aTrack,
// theMaterial->GetElement(i),
// theMaterial->GetTemperature()));
xSec[i] = theElastic[index].GetXsec(x);
xSec[i] *= rWeight;
sum+=xSec[i];
}
G4double random = G4UniformRand();
G4double running = 0;
for (i=0; i<n; i++)
{
running += xSec[i];
index = theMaterial->GetElement(i)->GetIndex();
if(random<=running/sum) break;
}
delete [] xSec;
// it is element-wise initialised.
}
return theElastic[index].ApplyYourself(aTrack);
}
G4bool G4NeutronHPorLElastic::IsThisElementOK( G4String name )
{
if ( unavailable_elements.find( name ) == unavailable_elements.end() )
return TRUE;
else
return FALSE;
}
void G4NeutronHPorLElastic::createXSectionDataSet()
{
theDataSet = new G4NeutronHPorLElasticData ( theElastic , &unavailable_elements );
}
@@ -0,0 +1,145 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of 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. *
// ********************************************************************
//
//
// 05-11-21 NeutronHP or Low Energy Parameterization Models
// Implemented by T. Koi (SLAC/SCCS)
// If NeutronHP data do not available for an element, then Low Energy
// Parameterization models handle the interactions of the element.
//
#include "G4NeutronHPorLElasticData.hh"
#include "G4Neutron.hh"
#include "G4ElementTable.hh"
#include "G4NeutronHPData.hh"
#include "G4PhysicsVector.hh"
G4NeutronHPorLElasticData::G4NeutronHPorLElasticData( G4NeutronHPChannel* pChannel , std::set< G4String >* pSet )
{
theElasticChannel = pChannel;
unavailable_elements = pSet;
}
G4bool G4NeutronHPorLElasticData::IsApplicable(const G4DynamicParticle*aP, const G4Element* anElement)
{
G4bool result = true;
G4double eKin = aP->GetKineticEnergy();
if(eKin>20*MeV||aP->GetDefinition()!=G4Neutron::Neutron()) result = false;
if ( unavailable_elements->find( anElement->GetName() ) != unavailable_elements->end() ) result = false;
return result;
}
G4NeutronHPorLElasticData::G4NeutronHPorLElasticData()
{
// BuildPhysicsTable(*G4Neutron::Neutron());
}
G4NeutronHPorLElasticData::~G4NeutronHPorLElasticData()
{
// delete theCrossSections;
}
void G4NeutronHPorLElasticData::BuildPhysicsTable( const G4ParticleDefinition& aP )
{
if( &aP!=G4Neutron::Neutron() )
throw G4HadronicException(__FILE__, __LINE__, "Attempt to use NeutronHP data for particles other than neutrons!!!");
}
void G4NeutronHPorLElasticData::DumpPhysicsTable(const G4ParticleDefinition& aP)
{
if(&aP!=G4Neutron::Neutron())
throw G4HadronicException(__FILE__, __LINE__, "Attempt to use NeutronHP data for particles other than neutrons!!!");
// G4cout << "G4NeutronHPorLElasticData::DumpPhysicsTable still to be implemented"<<G4endl;
}
#include "G4Nucleus.hh"
#include "G4NucleiPropertiesTable.hh"
#include "G4Neutron.hh"
#include "G4Electron.hh"
G4double G4NeutronHPorLElasticData::
GetCrossSection(const G4DynamicParticle* aP, const G4Element*anE, G4double aT)
{
//G4cout << "Choice G4NeutronHPorLElasticData for element " << anE->GetName() << G4endl;
G4double result = 0;
// G4bool outOfRange;
G4int index = anE->GetIndex();
// prepare neutron
G4double eKinetic = aP->GetKineticEnergy();
G4ReactionProduct theNeutron( aP->GetDefinition() );
theNeutron.SetMomentum( aP->GetMomentum() );
theNeutron.SetKineticEnergy( eKinetic );
// prepare thermal nucleus
G4Nucleus aNuc;
G4double eps = 0.0001;
G4double theA = anE->GetN();
G4double theZ = anE->GetZ();
G4double eleMass;
eleMass = ( G4NucleiPropertiesTable::GetNuclearMass(static_cast<G4int>(theZ+eps), static_cast<G4int>(theA+eps))
) / G4Neutron::Neutron()->GetPDGMass();
G4ReactionProduct boosted;
G4double aXsection;
// MC integration loop
G4int counter = 0;
G4double buffer = 0;
G4int size = G4int(std::max(10., aT/60*kelvin));
G4ThreeVector neutronVelocity = 1./G4Neutron::Neutron()->GetPDGMass()*theNeutron.GetMomentum();
G4double neutronVMag = neutronVelocity.mag();
while(counter == 0 || std::abs(buffer-result/std::max(1,counter)) > 0.03*buffer)
{
if(counter) buffer = result/counter;
while (counter<size)
{
counter ++;
G4ReactionProduct aThermalNuc = aNuc.GetThermalNucleus(eleMass, aT);
boosted.Lorentz(theNeutron, aThermalNuc);
G4double theEkin = boosted.GetKineticEnergy();
//aXsection = (*((*theCrossSections)(index))).GetValue(theEkin, outOfRange);
aXsection = theElasticChannel[index].GetXsec( theEkin );
// velocity correction.
G4ThreeVector targetVelocity = 1./aThermalNuc.GetMass()*aThermalNuc.GetMomentum();
aXsection *= (targetVelocity-neutronVelocity).mag()/neutronVMag;
result += aXsection;
}
size += size;
}
result /= counter;
return result;
}
@@ -0,0 +1,70 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of 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. *
// ********************************************************************
//
//
// 05-11-21 NeutronHP or Low Energy Parameterization Models
// Implemented by T. Koi (SLAC/SCCS)
// If NeutronHP data do not available for an element, then Low Energy
// Parameterization models handle the interactions of the element.
//
// 05-11-21 NeutronHP or Low Energy Prameterization Models
#include "G4NeutronHPorLElasticModel.hh"
G4NeutronHPorLElasticModel::G4NeutronHPorLElasticModel()
{
//theHPElastic = new G4NeutronHPElastic();
theHPElastic = new G4NeutronHPorLElastic();
theLElastic = new G4LElastic();
theHPNames = new G4NeutronHPNames();
}
G4NeutronHPorLElasticModel::~G4NeutronHPorLElasticModel()
{
delete theHPElastic;
delete theLElastic;
delete theHPNames;
}
G4HadFinalState* G4NeutronHPorLElasticModel::ApplyYourself(const G4HadProjectile& aTrack, G4Nucleus& aTargetNucleus)
{
if ( aTrack.GetKineticEnergy() > 20*MeV )
{
//G4cout << "Select LE model " << G4endl;
return theLElastic->ApplyYourself( aTrack , aTargetNucleus );
}
G4int Z = (G4int)(aTargetNucleus.GetZ()+0.5);
G4String theNameOfElement = theHPNames->GetName( Z-1 ); // GetName(0) reply "Hydrogen"
if ( theHPElastic->IsThisElementOK( theNameOfElement ) )
{
//G4cout << "Select HP model " << G4endl;
return theHPElastic->ApplyYourself( aTrack , aTargetNucleus );
}
else
{
//G4cout << "Select LE model " << G4endl;
return theLElastic->ApplyYourself( aTrack , aTargetNucleus );
}
}
@@ -0,0 +1,145 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of 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. *
// ********************************************************************
//
//
// 05-11-21 NeutronHP or Low Energy Parameterization Models
// Implemented by T. Koi (SLAC/SCCS)
// If NeutronHP data do not available for an element, then Low Energy
// Parameterization models handle the interactions of the element.
//
// neutron_hp -- source file
// J.P. Wellisch, Nov-1996
// A prototype of the low energy neutron transport model.
//
#include "G4NeutronHPorLFission.hh"
#include "G4NeutronHPFissionFS.hh"
G4NeutronHPorLFission::G4NeutronHPorLFission()
{
SetMinEnergy(0.*eV);
SetMaxEnergy(20.*MeV);
if( !getenv("NeutronHPCrossSections") )
throw G4HadronicException(__FILE__, __LINE__, "Please setenv NeutronHPCrossSections to point to the neutron cross-section files.");
dirName = getenv("NeutronHPCrossSections");
G4String tString = "/Fission/";
dirName = dirName + tString;
// G4cout <<"G4NeutronHPorLFission::G4NeutronHPorLFission testit "<<dirName<<G4endl;
unavailable_elements.clear();
numEle = G4Element::GetNumberOfElements();
theFission = new G4NeutronHPChannel[numEle];
for ( G4int i = 0; i < numEle ; i++)
{
if ( (*(G4Element::GetElementTable()))[i]-> GetZ() > 89 )
{
theFission[i].Init((*(G4Element::GetElementTable()))[i], dirName);
try { while(!theFission[i].Register(&theFS)); }
catch ( G4HadronicException )
{
unavailable_elements.insert ( (*(G4Element::GetElementTable()))[i]->GetName() );
}
}
}
if ( unavailable_elements.size() > 0 )
{
std::set< G4String>::iterator it;
G4cout << "HP Fission data are not available for thess elements "<< G4endl;
for ( it = unavailable_elements.begin() ; it != unavailable_elements.end() ; it++ )
{
G4cout << *it << G4endl;
}
G4cout << "Low Energy Parameterization Models will be used."<< G4endl;
}
createXSectionDataSet();
}
G4NeutronHPorLFission::~G4NeutronHPorLFission()
{
delete [] theFission;
delete theDataSet;
}
#include "G4NeutronHPThermalBoost.hh"
G4HadFinalState * G4NeutronHPorLFission::ApplyYourself(const G4HadProjectile& aTrack, G4Nucleus& )
{
const G4Material * theMaterial = aTrack.GetMaterial();
G4int n = theMaterial->GetNumberOfElements();
G4int index = theMaterial->GetElement(0)->GetIndex();
if(n!=1)
{
G4int i;
xSec = new G4double[n];
G4double sum=0;
const G4double * NumAtomsPerVolume = theMaterial->GetVecNbOfAtomsPerVolume();
G4double rWeight;
G4NeutronHPThermalBoost aThermalE;
for (i=0; i<n; i++)
{
index = theMaterial->GetElement(i)->GetIndex();
rWeight = NumAtomsPerVolume[i];
G4double x = aThermalE.GetThermalEnergy(aTrack, theMaterial->GetElement(i), theMaterial->GetTemperature());
//xSec[i] = theFission[index].GetXsec(aThermalE.GetThermalEnergy(aTrack,
// theMaterial->GetElement(i),
// theMaterial->GetTemperature()));
xSec[i] = theFission[index].GetXsec(x);
xSec[i] *= rWeight;
sum+=xSec[i];
}
G4double random = G4UniformRand();
G4double running = 0;
for (i=0; i<n; i++)
{
running += xSec[i];
index = theMaterial->GetElement(i)->GetIndex();
if(random<=running/sum) break;
}
delete [] xSec;
// it is element-wise initialised.
}
return theFission[index].ApplyYourself(aTrack);
}
G4bool G4NeutronHPorLFission::IsThisElementOK( G4String name )
{
if ( unavailable_elements.find( name ) == unavailable_elements.end() )
return TRUE;
else
return FALSE;
}
void G4NeutronHPorLFission::createXSectionDataSet()
{
theDataSet = new G4NeutronHPorLFissionData ( theFission , &unavailable_elements );
}
@@ -0,0 +1,145 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of 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. *
// ********************************************************************
//
//
// 05-11-21 NeutronHP or Low Energy Parameterization Models
// Implemented by T. Koi (SLAC/SCCS)
// If NeutronHP data do not available for an element, then Low Energy
// Parameterization models handle the interactions of the element.
//
#include "G4NeutronHPorLFissionData.hh"
#include "G4Neutron.hh"
#include "G4ElementTable.hh"
#include "G4NeutronHPData.hh"
#include "G4PhysicsVector.hh"
G4NeutronHPorLFissionData::G4NeutronHPorLFissionData( G4NeutronHPChannel* pChannel , std::set< G4String >* pSet )
{
theFissionChannel = pChannel;
unavailable_elements = pSet;
}
G4bool G4NeutronHPorLFissionData::IsApplicable(const G4DynamicParticle*aP, const G4Element* anElement)
{
G4bool result = true;
G4double eKin = aP->GetKineticEnergy();
if(eKin>20*MeV||aP->GetDefinition()!=G4Neutron::Neutron()) result = false;
if ( unavailable_elements->find( anElement->GetName() ) != unavailable_elements->end() ) result = false;
return result;
}
G4NeutronHPorLFissionData::G4NeutronHPorLFissionData()
{
// BuildPhysicsTable(*G4Neutron::Neutron());
}
G4NeutronHPorLFissionData::~G4NeutronHPorLFissionData()
{
// delete theCrossSections;
}
void G4NeutronHPorLFissionData::BuildPhysicsTable( const G4ParticleDefinition& aP )
{
if( &aP!=G4Neutron::Neutron() )
throw G4HadronicException(__FILE__, __LINE__, "Attempt to use NeutronHP data for particles other than neutrons!!!");
}
void G4NeutronHPorLFissionData::DumpPhysicsTable(const G4ParticleDefinition& aP)
{
if(&aP!=G4Neutron::Neutron())
throw G4HadronicException(__FILE__, __LINE__, "Attempt to use NeutronHP data for particles other than neutrons!!!");
// G4cout << "G4NeutronHPorLFissionData::DumpPhysicsTable still to be implemented"<<G4endl;
}
#include "G4Nucleus.hh"
#include "G4NucleiPropertiesTable.hh"
#include "G4Neutron.hh"
#include "G4Electron.hh"
G4double G4NeutronHPorLFissionData::
GetCrossSection(const G4DynamicParticle* aP, const G4Element*anE, G4double aT)
{
G4double result = 0;
if ( anE->GetZ() < 90 ) return result;
// G4bool outOfRange;
G4int index = anE->GetIndex();
// prepare neutron
G4double eKinetic = aP->GetKineticEnergy();
G4ReactionProduct theNeutron( aP->GetDefinition() );
theNeutron.SetMomentum( aP->GetMomentum() );
theNeutron.SetKineticEnergy( eKinetic );
// prepare thermal nucleus
G4Nucleus aNuc;
G4double eps = 0.0001;
G4double theA = anE->GetN();
G4double theZ = anE->GetZ();
G4double eleMass;
eleMass = ( G4NucleiPropertiesTable::GetNuclearMass(static_cast<G4int>(theZ+eps), static_cast<G4int>(theA+eps))
) / G4Neutron::Neutron()->GetPDGMass();
G4ReactionProduct boosted;
G4double aXsection;
// MC integration loop
G4int counter = 0;
G4double buffer = 0;
G4int size = G4int(std::max(10., aT/60*kelvin));
G4ThreeVector neutronVelocity = 1./G4Neutron::Neutron()->GetPDGMass()*theNeutron.GetMomentum();
G4double neutronVMag = neutronVelocity.mag();
while(counter == 0 || std::abs(buffer-result/std::max(1,counter)) > 0.03*buffer)
{
if(counter) buffer = result/counter;
while (counter<size)
{
counter ++;
G4ReactionProduct aThermalNuc = aNuc.GetThermalNucleus(eleMass, aT);
boosted.Lorentz(theNeutron, aThermalNuc);
G4double theEkin = boosted.GetKineticEnergy();
//aXsection = (*((*theCrossSections)(index))).GetValue(theEkin, outOfRange);
aXsection = theFissionChannel[index].GetXsec( theEkin );
// velocity correction.
G4ThreeVector targetVelocity = 1./aThermalNuc.GetMass()*aThermalNuc.GetMomentum();
aXsection *= (targetVelocity-neutronVelocity).mag()/neutronVMag;
result += aXsection;
}
size += size;
}
result /= counter;
return result;
}
@@ -0,0 +1,67 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of 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. *
// ********************************************************************
//
//
// 05-11-21 NeutronHP or Low Energy Parameterization Models
// Implemented by T. Koi (SLAC/SCCS)
// If NeutronHP data do not available for an element, then Low Energy
// Parameterization models handle the interactions of the element.
//
#include "G4NeutronHPorLFissionModel.hh"
G4NeutronHPorLFissionModel::G4NeutronHPorLFissionModel()
{
theHPFission = new G4NeutronHPorLFission();
theLFission = new G4LFission();
theHPNames = new G4NeutronHPNames();
}
G4NeutronHPorLFissionModel::~G4NeutronHPorLFissionModel()
{
delete theHPFission;
delete theLFission;
delete theHPNames;
}
G4HadFinalState* G4NeutronHPorLFissionModel::ApplyYourself(const G4HadProjectile& aTrack, G4Nucleus& aTargetNucleus)
{
if ( aTrack.GetKineticEnergy() > 20*MeV )
{
//G4cout << "Select LE model " << G4endl;
return theLFission->ApplyYourself( aTrack , aTargetNucleus );
}
G4int Z = (G4int)(aTargetNucleus.GetZ()+0.5);
G4String theNameOfElement = theHPNames->GetName( Z-1 ); // GetName(0) reply "Hydrogen"
if ( theHPFission->IsThisElementOK( theNameOfElement ) )
{
//G4cout << "Select HP model " << G4endl;
return theHPFission->ApplyYourself( aTrack , aTargetNucleus );
}
else
{
//G4cout << "Select LE model " << G4endl;
return theLFission->ApplyYourself( aTrack , aTargetNucleus );
}
}