Files
geant4/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPElasticData.cc
T
2016-06-08 16:10:37 +02:00

132 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 "G4NeutronHPElasticData.hh"
#include "G4Neutron.hh"
#include "G4ElementTable.hh"
#include "G4NeutronHPData.hh"
G4bool G4NeutronHPElasticData::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;
}
G4NeutronHPElasticData::G4NeutronHPElasticData()
{
BuildPhysicsTable(*G4Neutron::Neutron());
}
G4NeutronHPElasticData::~G4NeutronHPElasticData()
{
delete theCrossSections;
}
void G4NeutronHPElasticData::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 G4NeutronHPElasticData::DumpPhysicsTable(const G4ParticleDefinition& aP)
{
if(&aP!=G4Neutron::Neutron())
G4Exception("Attempt to use NeutronHP data for particles other than neutrons!!!");
// G4cout << "G4NeutronHPElasticData::DumpPhysicsTable still to be implemented"<<G4endl;
}
#include "G4Nucleus.hh"
#include "G4NucleiPropertiesTable.hh"
#include "G4Neutron.hh"
#include "G4Electron.hh"
G4double G4NeutronHPElasticData::
GetCrossSection(const G4DynamicParticle* aP, const G4Element*anE, G4double aT)
{
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::GetAtomicMass(theZ+eps, 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.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);
// velocity correction.
G4ThreeVector targetVelocity = 1./aThermalNuc.GetMass()*aThermalNuc.GetMomentum();
aXsection *= (targetVelocity+neutronVelocity).mag()/neutronVMag;
result += aXsection;
}
size += size;
}
result /= counter;
return result;
}