Files
geant4/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPFissionData.cc
T
2016-06-08 16:57:27 +02:00

131 lines
4.9 KiB
C++

//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// neutron_hp -- source file
// J.P. Wellisch, Nov-1996
// A prototype of the low energy neutron transport model.
//
#include "G4NeutronHPFissionData.hh"
#include "G4Neutron.hh"
#include "G4ElementTable.hh"
#include "G4NeutronHPData.hh"
G4bool G4NeutronHPFissionData::IsApplicable(const G4DynamicParticle*aP, const G4Element*anE)
{
G4bool result = true;
G4double eKin = aP->GetKineticEnergy();
if(eKin>20*MeV||aP->GetDefinition()!=G4Neutron::Neutron()) result = false;
return result;
}
G4NeutronHPFissionData::G4NeutronHPFissionData()
{
theCrossSections = NULL;
BuildPhysicsTable(*G4Neutron::Neutron());
}
G4NeutronHPFissionData::~G4NeutronHPFissionData()
{
if(theCrossSections!=NULL) delete theCrossSections;
}
void G4NeutronHPFissionData::BuildPhysicsTable(const G4ParticleDefinition& aP)
{
if(&aP!=G4Neutron::Neutron())
G4Exception("Attempt to use NeutronHP data for particles other than neutrons!!!");
size_t numberOfElements = G4Element::GetNumberOfElements();
theCrossSections = new G4PhysicsTable( numberOfElements );
// make a PhysicsVector for each element
static const G4ElementTable *theElementTable = G4Element::GetElementTable();
for( size_t i=0; i<numberOfElements; ++i )
{
G4PhysicsVector* physVec = G4NeutronHPData::
Instance()->MakePhysicsVector((*theElementTable)[i], this);
theCrossSections->push_back(physVec);
}
}
void G4NeutronHPFissionData::DumpPhysicsTable(const G4ParticleDefinition& aP)
{
if(&aP!=G4Neutron::Neutron())
G4Exception("Attempt to use NeutronHP data for particles other than neutrons!!!");
G4cout << "G4NeutronHPFissionData::DumpPhysicsTable still to be implemented"<<G4endl;
}
#include "G4NucleiPropertiesTable.hh"
G4double G4NeutronHPFissionData::
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::GetAtomicMass(static_cast<G4int>(theZ+eps), static_cast<G4int>(theA+eps))-
theZ*G4Electron::ElectronDefinition()->GetPDGMass()
) / G4Neutron::Neutron()->GetPDGMass();
G4ReactionProduct boosted;
G4double aXsection;
// MC integration loop
G4int counter = 0;
G4double buffer = 0;
G4int size = G4int(G4std::max(10., aT/60*kelvin));
G4ThreeVector neutronVelocity = 1./G4Neutron::Neutron()->GetPDGMass()*theNeutron.GetMomentum();
G4double neutronVMag = neutronVelocity.mag();
while(counter == 0 || abs(buffer-result/counter) > 0.01*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);
// velocity correction.
G4ThreeVector targetVelocity = 1./aThermalNuc.GetMass()*aThermalNuc.GetMomentum();
aXsection *= (targetVelocity-neutronVelocity).mag()/neutronVMag;
result += aXsection;
}
size += size;
}
result /= counter;
return result;
}