Import Geant4 0.0.0 source tree
This commit is contained in:
@@ -0,0 +1,108 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4InterpolationManager.hh"
|
||||
|
||||
G4InterpolationScheme G4InterpolationManager::MakeScheme(G4int it)
|
||||
{
|
||||
G4InterpolationScheme result;
|
||||
switch(it)
|
||||
{
|
||||
case 1:
|
||||
result = HISTO;
|
||||
break;
|
||||
case 2:
|
||||
result = LINLIN;
|
||||
break;
|
||||
case 3:
|
||||
result = LINLOG;
|
||||
break;
|
||||
case 4:
|
||||
result = LOGLIN;
|
||||
break;
|
||||
case 5:
|
||||
result = LOGLOG;
|
||||
break;
|
||||
case 11:
|
||||
result = CHISTO;
|
||||
break;
|
||||
case 12:
|
||||
result = CLINLIN;
|
||||
break;
|
||||
case 13:
|
||||
result = CLINLOG;
|
||||
break;
|
||||
case 14:
|
||||
result = CLOGLIN;
|
||||
break;
|
||||
case 15:
|
||||
result = CLOGLOG;
|
||||
break;
|
||||
case 21:
|
||||
result = UHISTO;
|
||||
break;
|
||||
case 22:
|
||||
result = ULINLIN;
|
||||
break;
|
||||
case 23:
|
||||
result = ULINLOG;
|
||||
break;
|
||||
case 24:
|
||||
result = ULOGLIN;
|
||||
break;
|
||||
case 25:
|
||||
result = ULOGLOG;
|
||||
break;
|
||||
default:
|
||||
G4Exception("G4InterpolationManager: unknown interpolation scheme");
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void G4InterpolationManager::AppendScheme(G4int aPoint, const G4InterpolationScheme & aScheme)
|
||||
{
|
||||
if(aPoint!=nEntries)
|
||||
{
|
||||
G4cout <<"G4InterpolationManager::AppendScheme - "<<aPoint<<" "<<nEntries<<endl;
|
||||
G4Exception("Wrong usage of G4InterpolationManager::AppendScheme");
|
||||
}
|
||||
if(nEntries==0)
|
||||
{
|
||||
nEntries = 1;
|
||||
nRanges = 1;
|
||||
start[0] = 0;
|
||||
range [0] = 1;
|
||||
scheme[0] = aScheme;
|
||||
}
|
||||
else if(aScheme==scheme[nRanges-1])
|
||||
{
|
||||
++range[nRanges-1];
|
||||
nEntries++;
|
||||
}
|
||||
else
|
||||
{
|
||||
nEntries++;
|
||||
nRanges++;
|
||||
G4int i;
|
||||
G4int * buffer = new G4int[nRanges];
|
||||
G4int * buffer1 = new G4int[nRanges];
|
||||
G4InterpolationScheme* buff2 = new G4InterpolationScheme[nRanges];
|
||||
for(i=0; i<nRanges-1; i++)
|
||||
{
|
||||
buffer[i] = start[i];
|
||||
buffer1[i] = range[i];
|
||||
buff2[i] = scheme[i];
|
||||
}
|
||||
delete [] start;
|
||||
delete [] range;
|
||||
delete [] scheme;
|
||||
start = buffer;
|
||||
range = buffer1;
|
||||
scheme = buff2;
|
||||
start[nRanges-1] = start[nRanges-2]+range[nRanges-2];
|
||||
range[nRanges-1] = 1;
|
||||
scheme[nRanges-1] = aScheme;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHP2AInelasticFS.hh"
|
||||
#include "G4Nucleus.hh"
|
||||
#include "G4Alpha.hh"
|
||||
|
||||
G4ParticleChange * G4NeutronHP2AInelasticFS::ApplyYourself(const G4Track & theTrack)
|
||||
{
|
||||
|
||||
// these are the particle types in the final state
|
||||
|
||||
G4ParticleDefinition * theDefs[2];
|
||||
theDefs[0] = G4Alpha::Alpha();
|
||||
theDefs[1] = G4Alpha::Alpha();
|
||||
|
||||
// fill the final state
|
||||
G4NeutronHPInelasticBaseFS::BaseApply(theTrack, theDefs, 2);
|
||||
|
||||
// return the result
|
||||
return &theResult;
|
||||
}
|
||||
|
||||
void G4NeutronHP2AInelasticFS::
|
||||
Init (G4double A, G4double Z, G4String & dirName, G4String & aFSType)
|
||||
{
|
||||
G4NeutronHPInelasticBaseFS::Init(A, Z, dirName, aFSType);
|
||||
G4double ResidualA = A-7;
|
||||
G4double ResidualZ = Z-4;
|
||||
G4NeutronHPInelasticBaseFS::InitGammas(ResidualA, ResidualZ);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHP2N2AInelasticFS.hh"
|
||||
#include "G4Nucleus.hh"
|
||||
#include "G4Neutron.hh"
|
||||
#include "G4Alpha.hh"
|
||||
|
||||
G4ParticleChange * G4NeutronHP2N2AInelasticFS::ApplyYourself(const G4Track & theTrack)
|
||||
{
|
||||
// these are the particle types in the final state
|
||||
|
||||
G4ParticleDefinition * theDefs[4];
|
||||
theDefs[0] = G4Neutron::Neutron();
|
||||
theDefs[1] = G4Neutron::Neutron();
|
||||
theDefs[2] = G4Alpha::Alpha();
|
||||
theDefs[3] = G4Alpha::Alpha();
|
||||
|
||||
// fill the final state
|
||||
G4NeutronHPInelasticBaseFS::BaseApply(theTrack, theDefs, 4);
|
||||
|
||||
// return the result
|
||||
return &theResult;
|
||||
}
|
||||
|
||||
void G4NeutronHP2N2AInelasticFS::
|
||||
Init (G4double A, G4double Z, G4String & dirName, G4String & aFSType)
|
||||
{
|
||||
G4NeutronHPInelasticBaseFS::Init(A, Z, dirName, aFSType);
|
||||
G4double ResidualA = A-9;
|
||||
G4double ResidualZ = Z-4;
|
||||
G4NeutronHPInelasticBaseFS::InitGammas(ResidualA, ResidualZ);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHP2NAInelasticFS.hh"
|
||||
#include "G4Nucleus.hh"
|
||||
#include "G4Alpha.hh"
|
||||
|
||||
G4ParticleChange * G4NeutronHP2NAInelasticFS::ApplyYourself(const G4Track & theTrack)
|
||||
{
|
||||
// these are the particle types in the final state
|
||||
|
||||
G4ParticleDefinition * theDefs[3];
|
||||
theDefs[0] = G4Neutron::Neutron();
|
||||
theDefs[1] = G4Neutron::Neutron();
|
||||
theDefs[2] = G4Alpha::Alpha();
|
||||
|
||||
// fill the final state
|
||||
G4NeutronHPInelasticBaseFS::BaseApply(theTrack, theDefs, 3);
|
||||
|
||||
// return the result
|
||||
return &theResult;
|
||||
}
|
||||
|
||||
void G4NeutronHP2NAInelasticFS::
|
||||
Init (G4double A, G4double Z, G4String & dirName, G4String & aFSType)
|
||||
{
|
||||
G4NeutronHPInelasticBaseFS::Init(A, Z, dirName, aFSType);
|
||||
G4double ResidualA = A-5;
|
||||
G4double ResidualZ = Z-2;
|
||||
G4NeutronHPInelasticBaseFS::InitGammas(ResidualA, ResidualZ);
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHP2NDInelasticFS.hh"
|
||||
#include "G4Nucleus.hh"
|
||||
#include "G4Deuteron.hh"
|
||||
|
||||
G4ParticleChange * G4NeutronHP2NDInelasticFS::ApplyYourself(const G4Track & theTrack)
|
||||
{
|
||||
// these are the particle types in the final state
|
||||
|
||||
G4ParticleDefinition * theDefs[3];
|
||||
theDefs[0] = G4Neutron::Neutron();
|
||||
theDefs[1] = G4Neutron::Neutron();
|
||||
theDefs[2] = G4Deuteron::Deuteron();
|
||||
|
||||
// fill the final state
|
||||
G4NeutronHPInelasticBaseFS::BaseApply(theTrack, theDefs, 3);
|
||||
|
||||
// return the result
|
||||
return &theResult;
|
||||
}
|
||||
|
||||
void G4NeutronHP2NDInelasticFS::
|
||||
Init (G4double A, G4double Z, G4String & dirName, G4String & aFSType)
|
||||
{
|
||||
G4NeutronHPInelasticBaseFS::Init(A, Z, dirName, aFSType);
|
||||
G4double ResidualA = A-3;
|
||||
G4double ResidualZ = Z-1;
|
||||
G4NeutronHPInelasticBaseFS::InitGammas(ResidualA, ResidualZ);
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHP2NInelasticFS.hh"
|
||||
#include "G4Nucleus.hh"
|
||||
#include "G4Alpha.hh"
|
||||
|
||||
G4ParticleChange * G4NeutronHP2NInelasticFS::ApplyYourself(const G4Track & theTrack)
|
||||
{
|
||||
|
||||
// these are the particle types in the final state
|
||||
|
||||
G4ParticleDefinition * theDefs[2];
|
||||
theDefs[0] = G4Neutron::Neutron();
|
||||
theDefs[1] = G4Neutron::Neutron();
|
||||
|
||||
// fill the final state
|
||||
G4NeutronHPInelasticBaseFS::BaseApply(theTrack, theDefs, 2);
|
||||
|
||||
// return the result
|
||||
return &theResult;
|
||||
}
|
||||
|
||||
void G4NeutronHP2NInelasticFS::
|
||||
Init (G4double A, G4double Z, G4String & dirName, G4String & aFSType)
|
||||
{
|
||||
G4NeutronHPInelasticBaseFS::Init(A, Z, dirName, aFSType);
|
||||
G4double ResidualA = A-1;
|
||||
G4double ResidualZ = Z;
|
||||
G4NeutronHPInelasticBaseFS::InitGammas(ResidualA, ResidualZ);
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHP2NPInelasticFS.hh"
|
||||
#include "G4Nucleus.hh"
|
||||
#include "G4Proton.hh"
|
||||
|
||||
G4ParticleChange * G4NeutronHP2NPInelasticFS::ApplyYourself(const G4Track & theTrack)
|
||||
{
|
||||
// these are the particle types in the final state
|
||||
|
||||
G4ParticleDefinition * theDefs[3];
|
||||
theDefs[0] = G4Neutron::Neutron();
|
||||
theDefs[1] = G4Neutron::Neutron();
|
||||
theDefs[2] = G4Proton::Proton();
|
||||
|
||||
// fill the final state
|
||||
G4NeutronHPInelasticBaseFS::BaseApply(theTrack, theDefs, 3);
|
||||
|
||||
// return the result
|
||||
return &theResult;
|
||||
}
|
||||
|
||||
void G4NeutronHP2NPInelasticFS::
|
||||
Init (G4double A, G4double Z, G4String & dirName, G4String & aFSType)
|
||||
{
|
||||
G4NeutronHPInelasticBaseFS::Init(A, Z, dirName, aFSType);
|
||||
G4double ResidualA = A-2;
|
||||
G4double ResidualZ = Z-1;
|
||||
G4NeutronHPInelasticBaseFS::InitGammas(ResidualA, ResidualZ);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHP2PInelasticFS.hh"
|
||||
#include "G4Nucleus.hh"
|
||||
#include "G4Proton.hh"
|
||||
|
||||
G4ParticleChange * G4NeutronHP2PInelasticFS::ApplyYourself(const G4Track & theTrack)
|
||||
{
|
||||
// these are the particle types in the final state
|
||||
|
||||
G4ParticleDefinition * theDefs[2];
|
||||
theDefs[0] = G4Proton::Proton();
|
||||
theDefs[1] = G4Proton::Proton();
|
||||
|
||||
// fill the final state
|
||||
G4NeutronHPInelasticBaseFS::BaseApply(theTrack, theDefs, 2);
|
||||
|
||||
// return the result
|
||||
return &theResult;
|
||||
}
|
||||
|
||||
void G4NeutronHP2PInelasticFS::
|
||||
Init (G4double A, G4double Z, G4String & dirName, G4String & aFSType)
|
||||
{
|
||||
G4NeutronHPInelasticBaseFS::Init(A, Z, dirName, aFSType);
|
||||
G4double ResidualA = A-1;
|
||||
G4double ResidualZ = Z-2;
|
||||
G4NeutronHPInelasticBaseFS::InitGammas(ResidualA, ResidualZ);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHP3AInelasticFS.hh"
|
||||
#include "G4Nucleus.hh"
|
||||
#include "G4Alpha.hh"
|
||||
|
||||
G4ParticleChange * G4NeutronHP3AInelasticFS::ApplyYourself(const G4Track & theTrack)
|
||||
{
|
||||
// these are the particle types in the final state
|
||||
|
||||
G4ParticleDefinition * theDefs[3];
|
||||
theDefs[0] = G4Alpha::Alpha();
|
||||
theDefs[1] = G4Alpha::Alpha();
|
||||
theDefs[2] = G4Alpha::Alpha();
|
||||
|
||||
// fill the final state
|
||||
G4NeutronHPInelasticBaseFS::BaseApply(theTrack, theDefs, 3);
|
||||
|
||||
// return the result
|
||||
return &theResult;
|
||||
}
|
||||
|
||||
void G4NeutronHP3AInelasticFS::
|
||||
Init (G4double A, G4double Z, G4String & dirName, G4String & aFSType)
|
||||
{
|
||||
G4NeutronHPInelasticBaseFS::Init(A, Z, dirName, aFSType);
|
||||
G4double ResidualA = A-11;
|
||||
G4double ResidualZ = Z-6;
|
||||
G4NeutronHPInelasticBaseFS::InitGammas(ResidualA, ResidualZ);
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHP3NAInelasticFS.hh"
|
||||
#include "G4Nucleus.hh"
|
||||
#include "G4Alpha.hh"
|
||||
|
||||
G4ParticleChange * G4NeutronHP3NAInelasticFS::ApplyYourself(const G4Track & theTrack)
|
||||
{
|
||||
// these are the particle types in the final state
|
||||
|
||||
G4ParticleDefinition * theDefs[4];
|
||||
theDefs[0] = G4Neutron::Neutron();
|
||||
theDefs[1] = G4Neutron::Neutron();
|
||||
theDefs[2] = G4Neutron::Neutron();
|
||||
theDefs[3] = G4Alpha::Alpha();
|
||||
|
||||
// fill the final state
|
||||
G4NeutronHPInelasticBaseFS::BaseApply(theTrack, theDefs, 4);
|
||||
|
||||
// return the result
|
||||
return &theResult;
|
||||
}
|
||||
|
||||
void G4NeutronHP3NAInelasticFS::
|
||||
Init (G4double A, G4double Z, G4String & dirName, G4String & aFSType)
|
||||
{
|
||||
G4NeutronHPInelasticBaseFS::Init(A, Z, dirName, aFSType);
|
||||
G4double ResidualA = A-6;
|
||||
G4double ResidualZ = Z-2;
|
||||
G4NeutronHPInelasticBaseFS::InitGammas(ResidualA, ResidualZ);
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHP3NInelasticFS.hh"
|
||||
#include "G4Nucleus.hh"
|
||||
#include "G4Alpha.hh"
|
||||
|
||||
G4ParticleChange * G4NeutronHP3NInelasticFS::ApplyYourself(const G4Track & theTrack)
|
||||
{
|
||||
// these are the particle types in the final state
|
||||
|
||||
G4ParticleDefinition * theDefs[3];
|
||||
theDefs[0] = G4Neutron::Neutron();
|
||||
theDefs[1] = G4Neutron::Neutron();
|
||||
theDefs[2] = G4Neutron::Neutron();
|
||||
|
||||
// fill the final state
|
||||
G4NeutronHPInelasticBaseFS::BaseApply(theTrack, theDefs, 3);
|
||||
|
||||
// return the result
|
||||
return &theResult;
|
||||
}
|
||||
|
||||
void G4NeutronHP3NInelasticFS::
|
||||
Init (G4double A, G4double Z, G4String & dirName, G4String & aFSType)
|
||||
{
|
||||
G4NeutronHPInelasticBaseFS::Init(A, Z, dirName, aFSType);
|
||||
G4double ResidualA = A-2;
|
||||
G4double ResidualZ = Z;
|
||||
G4NeutronHPInelasticBaseFS::InitGammas(ResidualA, ResidualZ);
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHP3NPInelasticFS.hh"
|
||||
#include "G4Nucleus.hh"
|
||||
#include "G4Proton.hh"
|
||||
|
||||
G4ParticleChange * G4NeutronHP3NPInelasticFS::ApplyYourself(const G4Track & theTrack)
|
||||
{
|
||||
// these are the particle types in the final state
|
||||
|
||||
G4ParticleDefinition * theDefs[4];
|
||||
theDefs[0] = G4Neutron::Neutron();
|
||||
theDefs[1] = G4Neutron::Neutron();
|
||||
theDefs[2] = G4Neutron::Neutron();
|
||||
theDefs[3] = G4Proton::Proton();
|
||||
|
||||
// fill the final state
|
||||
G4NeutronHPInelasticBaseFS::BaseApply(theTrack, theDefs, 4);
|
||||
|
||||
// return the result
|
||||
return &theResult;
|
||||
}
|
||||
|
||||
void G4NeutronHP3NPInelasticFS::
|
||||
Init (G4double A, G4double Z, G4String & dirName, G4String & aFSType)
|
||||
{
|
||||
G4NeutronHPInelasticBaseFS::Init(A, Z, dirName, aFSType);
|
||||
G4double ResidualA = A-3;
|
||||
G4double ResidualZ = Z-1;
|
||||
G4NeutronHPInelasticBaseFS::InitGammas(ResidualA, ResidualZ);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHP4NInelasticFS.hh"
|
||||
#include "G4Nucleus.hh"
|
||||
#include "G4Alpha.hh"
|
||||
|
||||
G4ParticleChange * G4NeutronHP4NInelasticFS::ApplyYourself(const G4Track & theTrack)
|
||||
{
|
||||
// these are the particle types in the final state
|
||||
|
||||
G4ParticleDefinition * theDefs[4];
|
||||
theDefs[0] = G4Neutron::Neutron();
|
||||
theDefs[1] = G4Neutron::Neutron();
|
||||
theDefs[2] = G4Neutron::Neutron();
|
||||
theDefs[3] = G4Neutron::Neutron();
|
||||
|
||||
// fill the final state
|
||||
G4NeutronHPInelasticBaseFS::BaseApply(theTrack, theDefs, 4);
|
||||
|
||||
// return the result
|
||||
return &theResult;
|
||||
}
|
||||
|
||||
void G4NeutronHP4NInelasticFS::
|
||||
Init (G4double A, G4double Z, G4String & dirName, G4String & aFSType)
|
||||
{
|
||||
G4NeutronHPInelasticBaseFS::Init(A, Z, dirName, aFSType);
|
||||
G4double ResidualA = A-3;
|
||||
G4double ResidualZ = Z;
|
||||
G4NeutronHPInelasticBaseFS::InitGammas(ResidualA, ResidualZ);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHPAInelasticFS.hh"
|
||||
#include "G4Nucleus.hh"
|
||||
#include "G4Alpha.hh"
|
||||
|
||||
void G4NeutronHPAInelasticFS::Init (G4double A, G4double Z, G4String & dirName, G4String & aFSType)
|
||||
{
|
||||
G4NeutronHPInelasticCompFS::Init(A, Z, dirName, aFSType);
|
||||
G4double ResidualA = A-3;
|
||||
G4double ResidualZ = Z-2;
|
||||
G4NeutronHPInelasticCompFS::InitGammas(ResidualA, ResidualZ);
|
||||
}
|
||||
|
||||
G4ParticleChange * G4NeutronHPAInelasticFS::ApplyYourself(const G4Track & theTrack)
|
||||
{
|
||||
|
||||
// do the final state
|
||||
G4NeutronHPInelasticCompFS::CompositeApply(theTrack, G4Alpha::Alpha());
|
||||
|
||||
// return the result
|
||||
return &theResult;
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHPAngular.hh"
|
||||
|
||||
void G4NeutronHPAngular::Init(ifstream & aDataFile)
|
||||
{
|
||||
// G4cout << "here we are entering the Angular Init"<<endl;
|
||||
G4int dummy;
|
||||
aDataFile >> theAngularDistributionType >> targetMass;
|
||||
aDataFile >> frameFlag;
|
||||
if(theAngularDistributionType == 0)
|
||||
{
|
||||
theIsoFlag = true;
|
||||
}
|
||||
else if(theAngularDistributionType==1)
|
||||
{
|
||||
G4int nEnergy;
|
||||
aDataFile >> nEnergy;
|
||||
theCoefficients = new G4NeutronHPLegendreStore(nEnergy);
|
||||
theCoefficients->InitInterpolation(aDataFile);
|
||||
G4double temp, energy;
|
||||
G4int tempdep, nLegendre;
|
||||
G4int i, ii;
|
||||
for (i=0; i<nEnergy; i++)
|
||||
{
|
||||
aDataFile >> temp >> energy >> tempdep >> nLegendre;
|
||||
energy *=eV;
|
||||
theCoefficients->Init(i, energy, nLegendre);
|
||||
theCoefficients->SetTemperature(i, temp);
|
||||
G4double coeff=0;
|
||||
for(ii=0; ii<nLegendre; ii++)
|
||||
{
|
||||
aDataFile >> coeff;
|
||||
theCoefficients->SetCoeff(i, ii+1, coeff);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (theAngularDistributionType==2)
|
||||
{
|
||||
G4int nEnergy;
|
||||
aDataFile >> nEnergy;
|
||||
theProbArray = new G4NeutronHPPartial(nEnergy, nEnergy);
|
||||
theProbArray->InitInterpolation(aDataFile);
|
||||
G4double temp, energy;
|
||||
G4int tempdep, nPoints;
|
||||
for(G4int i=0; i<nEnergy; i++)
|
||||
{
|
||||
aDataFile >> temp >> energy >> tempdep;
|
||||
energy *= eV;
|
||||
theProbArray->SetT(i, temp);
|
||||
theProbArray->SetX(i, energy);
|
||||
theProbArray->InitData(i, aDataFile);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
theIsoFlag = false;
|
||||
G4cout << "unknown distribution found for Angular"<<endl;
|
||||
G4Exception("unknown distribution needs implementation!!!");
|
||||
}
|
||||
}
|
||||
|
||||
void G4NeutronHPAngular::SampleAndUpdate(G4ReactionProduct & aHadron)
|
||||
{
|
||||
if(theIsoFlag)
|
||||
{
|
||||
// G4cout << "Angular result "<<aHadron.GetTotalMomentum()<<" ";
|
||||
G4double costheta = 2.*G4UniformRand()-1;
|
||||
G4double theta = acos(costheta);
|
||||
G4double phi = twopi*G4UniformRand();
|
||||
G4double sinth = sin(theta);
|
||||
G4double en = aHadron.GetTotalMomentum();
|
||||
G4ThreeVector temp(en*sinth*cos(phi), en*sinth*sin(phi), en*cos(theta) );
|
||||
aHadron.SetMomentum( temp );
|
||||
aHadron.Lorentz(aHadron, -1.*theTarget);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(theAngularDistributionType == 1) // LAB
|
||||
{
|
||||
G4double en = aHadron.GetTotalMomentum();
|
||||
G4ReactionProduct boosted;
|
||||
boosted.Lorentz(theNeutron, theTarget);
|
||||
G4double kineticEnergy = boosted.GetKineticEnergy();
|
||||
G4double cosTh = theCoefficients->SampleMax(kineticEnergy);
|
||||
G4double theta = acos(cosTh);
|
||||
G4double phi = twopi*G4UniformRand();
|
||||
G4double sinth = sin(theta);
|
||||
G4ThreeVector temp(en*sinth*cos(phi), en*sinth*sin(phi), en*cos(theta) );
|
||||
aHadron.SetMomentum( temp );
|
||||
}
|
||||
else if(theAngularDistributionType == 2) // costh in CMS
|
||||
{
|
||||
G4ReactionProduct boostedN;
|
||||
boostedN.Lorentz(theNeutron, theTarget);
|
||||
G4double kineticEnergy = boostedN.GetKineticEnergy();
|
||||
G4double cosTh = theProbArray->Sample(kineticEnergy);
|
||||
G4double theta = acos(cosTh);
|
||||
G4double phi = twopi*G4UniformRand();
|
||||
G4double sinth = sin(theta);
|
||||
|
||||
G4ThreeVector temp(sinth*cos(phi), sinth*sin(phi), cos(theta) ); //CMS
|
||||
G4double en = aHadron.GetTotalEnergy(); // Target rest
|
||||
|
||||
// get trafo from Target rest frame to CMS
|
||||
G4ReactionProduct boostedT;
|
||||
boostedT.Lorentz(theTarget, theTarget);
|
||||
|
||||
G4ThreeVector the3Neutron = boostedN.GetMomentum();
|
||||
G4double nEnergy = boostedN.GetTotalEnergy();
|
||||
G4ThreeVector the3Target = boostedT.GetMomentum();
|
||||
G4double tEnergy = boostedT.GetTotalEnergy();
|
||||
G4double totE = nEnergy+tEnergy;
|
||||
G4ThreeVector the3trafo = -the3Target-the3Neutron;
|
||||
G4ReactionProduct trafo; // for transformation from CMS to target rest frame
|
||||
trafo.SetMomentum(the3trafo);
|
||||
G4double cmsMom = sqrt(the3trafo*the3trafo);
|
||||
G4double sqrts = sqrt((totE-cmsMom)*(totE+cmsMom));
|
||||
trafo.SetMass(sqrts);
|
||||
trafo.SetTotalEnergy(totE);
|
||||
|
||||
G4double gamma = trafo.GetTotalEnergy()/trafo.GetMass();
|
||||
G4double cosalpha = temp*trafo.GetMomentum()/trafo.GetTotalMomentum()/temp.mag();
|
||||
G4double fac = cosalpha*trafo.GetTotalMomentum()/trafo.GetMass();
|
||||
fac*=gamma;
|
||||
|
||||
G4double mom;
|
||||
mom = sqrt( en*fac*en*fac -
|
||||
(fac*fac - gamma*gamma)*
|
||||
(en*en - gamma*gamma*aHadron.GetMass()*aHadron.GetMass())
|
||||
);
|
||||
mom = -en*fac - mom;
|
||||
mom /= (fac*fac-gamma*gamma);
|
||||
temp = mom*temp;
|
||||
|
||||
aHadron.SetMomentum( temp ); // now all in CMS
|
||||
aHadron.SetTotalEnergy( sqrt( mom*mom + aHadron.GetMass()*aHadron.GetMass() ) );
|
||||
aHadron.Lorentz(aHadron, trafo); // now in target rest frame
|
||||
}
|
||||
else
|
||||
{
|
||||
G4Exception("Tried to sample non isotropic neutron angular");
|
||||
}
|
||||
}
|
||||
aHadron.Lorentz(aHadron, -1.*theTarget);
|
||||
// G4cout << aHadron.GetMomentum()<<" ";
|
||||
// G4cout << aHadron.GetTotalMomentum()<<endl;
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHPArbitaryTab.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
G4double G4NeutronHPArbitaryTab::Sample(G4double anEnergy)
|
||||
{
|
||||
G4int i;
|
||||
for(i=0;i<nDistFunc;i++)
|
||||
{
|
||||
if(anEnergy<theDistFunc[i].GetLabel()) break; // that is the energy we need
|
||||
}
|
||||
G4int low, high;
|
||||
if(i==nDistFunc)
|
||||
{
|
||||
low = i-2;
|
||||
high = i-1;
|
||||
}
|
||||
else if(i==0)
|
||||
{
|
||||
if(nDistFunc==0)
|
||||
{
|
||||
G4cerr << "No distribution functions to sample "
|
||||
<< "from in G4NeutronHPArbitaryTab::Sample"<<endl;
|
||||
G4Exception();
|
||||
}
|
||||
else
|
||||
{
|
||||
return theDistFunc[0].Sample();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
low = i-1;
|
||||
high = i;
|
||||
}
|
||||
theBuffer.Merge(theManager.GetScheme(low), anEnergy,
|
||||
theDistFunc+low, theDistFunc+high);
|
||||
return theBuffer.Sample();
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHPCapture.hh"
|
||||
#include "G4NeutronHPCaptureFS.hh"
|
||||
|
||||
G4NeutronHPCapture::G4NeutronHPCapture()
|
||||
{
|
||||
// G4cout << "Capture : start of construction!!!!!!!!"<<endl;
|
||||
dirName = getenv("NeutronHPCrossSections");
|
||||
G4String tString = "/Capture/";
|
||||
dirName = dirName + tString;
|
||||
numEle = G4Element::GetNumberOfElements();
|
||||
// G4cout << "+++++++++++++++++++++++++++++++++++++++++++++++++"<<endl;
|
||||
// G4cout <<"Disname="<<dirName<<" numEle="<<numEle<<endl;
|
||||
theCapture = new G4NeutronHPChannel[numEle];
|
||||
// G4cout <<"G4NeutronHPChannel constructed"<<endl;
|
||||
G4NeutronHPCaptureFS * theFS = new G4NeutronHPCaptureFS;
|
||||
for (G4int i=0; i<numEle; i++)
|
||||
{
|
||||
// G4cout << "initializing theCapture "<<i<<" "<< numEle<<endl;
|
||||
theCapture[i].Init((*(G4Element::GetElementTable()))(i), dirName);
|
||||
theCapture[i].Register(theFS);
|
||||
}
|
||||
delete theFS;
|
||||
// G4cout << "-------------------------------------------------"<<endl;
|
||||
// G4cout << "Leaving G4NeutronHPCapture::G4NeutronHPCapture"<<endl;
|
||||
}
|
||||
|
||||
G4NeutronHPCapture::~G4NeutronHPCapture()
|
||||
{
|
||||
delete [] theCapture;
|
||||
// G4cout << "Leaving G4NeutronHPCapture::~G4NeutronHPCapture"<<endl;
|
||||
}
|
||||
|
||||
G4VParticleChange * G4NeutronHPCapture::ApplyYourself(const G4Track& aTrack, G4Nucleus& aTargetNucleus)
|
||||
{
|
||||
G4Material * theMaterial = aTrack.GetMaterial();
|
||||
G4int n = theMaterial->GetNumberOfElements();
|
||||
xSec = new G4double(n);
|
||||
G4double sum=0;
|
||||
G4int i, index;
|
||||
for (i=0; i<n; i++)
|
||||
{
|
||||
index = theMaterial->GetElement(i)->GetIndex();
|
||||
xSec[i] = theCapture[index].GetXsec(aTrack.GetKineticEnergy());
|
||||
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;
|
||||
return theCapture[index].ApplyYourself(aTrack);
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHPCaptureData.hh"
|
||||
#include "G4Neutron.hh"
|
||||
#include "G4ElementTable.hh"
|
||||
#include "G4NeutronHPData.hh"
|
||||
|
||||
G4bool G4NeutronHPCaptureData::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;
|
||||
}
|
||||
|
||||
G4NeutronHPCaptureData::G4NeutronHPCaptureData()
|
||||
{
|
||||
BuildPhysicsTable(*G4Neutron::Neutron());
|
||||
}
|
||||
|
||||
G4NeutronHPCaptureData::~G4NeutronHPCaptureData()
|
||||
{
|
||||
delete theCrossSections;
|
||||
}
|
||||
|
||||
void G4NeutronHPCaptureData::BuildPhysicsTable(const G4ParticleDefinition& aP)
|
||||
{
|
||||
if(&aP!=G4Neutron::Neutron())
|
||||
G4Exception("Attempt to use NeutronHP data for particles other than neutrons!!!");
|
||||
G4int numberOfElements = G4Element::GetNumberOfElements();
|
||||
theCrossSections = new G4PhysicsTable( numberOfElements );
|
||||
|
||||
// make a PhysicsVector for each element
|
||||
|
||||
static const G4ElementTable *theElementTable = G4Element::GetElementTable();
|
||||
for( G4int i=0; i<numberOfElements; ++i )
|
||||
(*theCrossSections)(i) =
|
||||
G4NeutronHPData::
|
||||
Instance()->MakePhysicsVector((*theElementTable)[i], this);
|
||||
}
|
||||
|
||||
void G4NeutronHPCaptureData::DumpPhysicsTable(const G4ParticleDefinition& aP)
|
||||
{
|
||||
if(&aP!=G4Neutron::Neutron())
|
||||
G4Exception("Attempt to use NeutronHP data for particles other than neutrons!!!");
|
||||
G4cout << "G4NeutronHPCaptureData::DumpPhysicsTable still to be implemented"<<endl;
|
||||
}
|
||||
|
||||
G4double G4NeutronHPCaptureData::GetCrossSection(const G4DynamicParticle* aP, const G4Element*anE)
|
||||
{
|
||||
G4double result;
|
||||
G4bool outOfRange;
|
||||
G4int index = anE->GetIndex();
|
||||
|
||||
result = (*((*theCrossSections)(index))).GetValue(
|
||||
aP->GetTotalMomentum()/GeV, outOfRange);
|
||||
return result;
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHPCaptureFS.hh"
|
||||
#include "G4Gamma.hh"
|
||||
#include "G4ReactionProduct.hh"
|
||||
#include "G4Nucleus.hh"
|
||||
#include "G4PhotonEvaporation.hh"
|
||||
#include "G4Fragment.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4NeutronHPDataUsed.hh"
|
||||
|
||||
G4ParticleChange * G4NeutronHPCaptureFS::ApplyYourself(const G4Track & theTrack)
|
||||
{
|
||||
G4int i;
|
||||
theResult.Initialize(theTrack);
|
||||
|
||||
// prepare neutron
|
||||
G4double eKinetic = theTrack.GetKineticEnergy();
|
||||
const G4DynamicParticle *incidentParticle = theTrack.GetDynamicParticle();
|
||||
G4ReactionProduct theNeutron( incidentParticle->GetDefinition() );
|
||||
theNeutron.SetMomentum( incidentParticle->GetMomentum() );
|
||||
theNeutron.SetKineticEnergy( eKinetic );
|
||||
|
||||
// prepare target
|
||||
G4ReactionProduct theTarget;
|
||||
G4Nucleus aNucleus;
|
||||
G4double eps = 0.0001;
|
||||
if(targetMass<500*MeV)
|
||||
targetMass = ( G4NucleiPropertiesTable::GetAtomicMass(theBaseZ+eps, theBaseA+eps)-
|
||||
theBaseZ* G4Electron::Electron()->GetPDGMass() ) /
|
||||
G4Neutron::Neutron()->GetPDGMass();
|
||||
theTarget = aNucleus.GetThermalNucleus(targetMass);
|
||||
|
||||
// go to nucleus rest system
|
||||
theNeutron.Lorentz(theNeutron, -1*theTarget);
|
||||
eKinetic = theNeutron.GetKineticEnergy();
|
||||
|
||||
// dice the photons
|
||||
|
||||
G4ReactionProductVector * thePhotons = NULL;
|
||||
if (HasFSData())
|
||||
{
|
||||
thePhotons = theFinalStatePhotons.GetPhotons(eKinetic);
|
||||
}
|
||||
else
|
||||
{
|
||||
G4ThreeVector aCMSMomentum = theNeutron.GetMomentum()+theTarget.GetMomentum();
|
||||
G4LorentzVector p4(aCMSMomentum, theTarget.GetTotalEnergy() + theNeutron.GetTotalEnergy()
|
||||
+ theBaseZ*G4Electron::ElectronDefinition()->GetPDGMass());
|
||||
G4Fragment nucleus(theBaseA+1, theBaseZ ,p4);
|
||||
G4PhotonEvaporation photonEvaporation;
|
||||
G4FragmentVector* products = photonEvaporation.BreakItUp(nucleus);
|
||||
G4int i;
|
||||
thePhotons = new G4ReactionProductVector;
|
||||
for(i=0; i<products->entries(); i++)
|
||||
{
|
||||
G4ReactionProduct * theOne = new G4ReactionProduct;
|
||||
theOne->SetDefinition( G4Gamma::Gamma() );
|
||||
G4ParticleTable* theTable = G4ParticleTable::GetParticleTable();
|
||||
if(products->at(i)->GetMomentum().mag() > 10*MeV)
|
||||
theOne->SetDefinition(
|
||||
theTable->FindIon(theBaseZ, theBaseA+1, 0, theBaseZ) );
|
||||
theOne->SetMomentum( products->at(i)->GetMomentum().vect() ) ;
|
||||
theOne->SetTotalEnergy( products->at(i)->GetMomentum().t() );
|
||||
thePhotons->insert(theOne);
|
||||
delete products->at(i);
|
||||
}
|
||||
delete products;
|
||||
}
|
||||
|
||||
// add them to the final state
|
||||
|
||||
G4int nPhotons = 0;
|
||||
if(thePhotons!=NULL) nPhotons=thePhotons->length();
|
||||
theResult.SetNumberOfSecondaries(nPhotons);
|
||||
for(i=0; i<nPhotons; i++)
|
||||
{
|
||||
// back to lab system
|
||||
thePhotons->at(i)->Lorentz(*(thePhotons->at(i)), theTarget);
|
||||
G4DynamicParticle * theOne = new G4DynamicParticle;
|
||||
theOne->SetDefinition(thePhotons->at(i)->GetDefinition());
|
||||
theOne->SetMomentum(thePhotons->at(i)->GetMomentum());
|
||||
theResult.AddSecondary(theOne);
|
||||
delete thePhotons->at(i);
|
||||
}
|
||||
delete thePhotons;
|
||||
|
||||
// clean up the primary neutron
|
||||
theResult.SetStatusChange(fStopAndKill);
|
||||
return &theResult;
|
||||
}
|
||||
|
||||
void G4NeutronHPCaptureFS::Init (G4double A, G4double Z, G4String & dirName, G4String & aFSType)
|
||||
{
|
||||
G4String tString = "/FS/";
|
||||
G4bool dbool;
|
||||
G4NeutronHPDataUsed aFile = theNames.GetName(A, Z, dirName, tString, dbool);
|
||||
G4String filename = aFile.GetName();
|
||||
theBaseA = aFile.GetA();
|
||||
theBaseZ = aFile.GetZ();
|
||||
if(!dbool)
|
||||
{
|
||||
hasAnyData = false;
|
||||
hasFSData = false;
|
||||
hasXsec = false;
|
||||
return;
|
||||
}
|
||||
ifstream theData(filename, ios::in);
|
||||
|
||||
hasFSData = theFinalStatePhotons.InitMean(theData);
|
||||
if(hasFSData)
|
||||
{
|
||||
targetMass = theFinalStatePhotons.GetTargetMass();
|
||||
theFinalStatePhotons.InitAngular(theData);
|
||||
theFinalStatePhotons.InitEnergies(theData);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,208 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHPChannel.hh"
|
||||
#include "G4NeutronHPFinalState.hh"
|
||||
|
||||
G4double G4NeutronHPChannel::GetXsec(G4double energy)
|
||||
{
|
||||
return theChannelData->GetXsec(energy);
|
||||
}
|
||||
|
||||
G4double G4NeutronHPChannel::GetWeightedXsec(G4double energy, G4int isoNumber)
|
||||
{
|
||||
return theIsotopeWiseData[isoNumber].GetXsec(energy);
|
||||
}
|
||||
|
||||
G4double G4NeutronHPChannel::GetFSCrossSection(G4double energy, G4int isoNumber)
|
||||
{
|
||||
return theFinalStates[isoNumber]->GetXsec(energy);
|
||||
}
|
||||
|
||||
void G4NeutronHPChannel::
|
||||
Init(G4Element * anElement, const G4String dirName, const G4String aFSType)
|
||||
{
|
||||
theFSType = aFSType;
|
||||
Init(anElement, dirName);
|
||||
}
|
||||
|
||||
void G4NeutronHPChannel::Init(G4Element * anElement, const G4String dirName)
|
||||
{
|
||||
theDir = dirName;
|
||||
theElement = anElement;
|
||||
}
|
||||
|
||||
G4bool G4NeutronHPChannel::Register(G4NeutronHPFinalState *theFS)
|
||||
{
|
||||
registerCount++;
|
||||
G4int Z = theElement->GetZ();
|
||||
if(registerCount<5)
|
||||
{
|
||||
Z = Z-registerCount;
|
||||
}
|
||||
if(Z==theElement->GetZ()-5) G4Exception("Channel: Do not know what to do with this material");
|
||||
G4int count = 0;
|
||||
if(registerCount==0) count = theElement->GetNumberOfIsotopes();
|
||||
if(count == 0||registerCount!=0) count +=
|
||||
theStableOnes.GetNumberOfIsotopes(Z);
|
||||
niso = count;
|
||||
if(theIsotopeWiseData!=NULL) delete [] theIsotopeWiseData;
|
||||
theIsotopeWiseData = new G4NeutronHPIsoData [niso];
|
||||
if(active!=NULL) delete [] active;
|
||||
active = new G4bool[niso];
|
||||
if(theFinalStates!=NULL) delete [] theFinalStates;
|
||||
theFinalStates = new G4NeutronHPFinalState * [niso];
|
||||
delete theChannelData;
|
||||
theChannelData = new G4NeutronHPVector;
|
||||
for(G4int i=0; i<niso; i++)
|
||||
{
|
||||
theFinalStates[i] = theFS->New();
|
||||
}
|
||||
count = 0;
|
||||
G4int nIsos = niso;
|
||||
if(theElement->GetNumberOfIsotopes()!=0&®isterCount==0)
|
||||
{
|
||||
for (G4int i1=0; i1<nIsos; i1++)
|
||||
{
|
||||
// G4cout <<" Init: normal case"<<endl;
|
||||
G4int A = theElement->GetIsotope(i1)->GetN();
|
||||
G4double frac = theElement->GetRelativeAbundanceVector()[i1]/perCent;
|
||||
UpdateData(A, Z, count++, frac);
|
||||
}
|
||||
} else {
|
||||
G4int first = theStableOnes.GetFirstIsotope(Z);
|
||||
for(G4int i1=0;
|
||||
i1<theStableOnes.GetNumberOfIsotopes(Z);
|
||||
i1++)
|
||||
{
|
||||
G4int A = theStableOnes.GetIsotopeNucleonCount(first+i1);
|
||||
G4double frac = theStableOnes.GetAbundance(first+i1);
|
||||
UpdateData(A, Z, count++, frac);
|
||||
}
|
||||
}
|
||||
G4bool result = HasDataInAnyFinalState();
|
||||
return result;
|
||||
}
|
||||
|
||||
void G4NeutronHPChannel::UpdateData(G4int A, G4int Z, G4int index, G4double abundance)
|
||||
{
|
||||
theFinalStates[index]->Init(A, Z, theDir, theFSType);
|
||||
if(!theFinalStates[index]->HasAnyData()) return; // nothing there for exactly this isotope.
|
||||
|
||||
// the above has put the X-sec into the FS
|
||||
theBuffer = NULL;
|
||||
if(theFinalStates[index]->HasXsec())
|
||||
{
|
||||
theBuffer = theFinalStates[index]->GetXsec();
|
||||
theBuffer->Times(abundance/100.);
|
||||
theIsotopeWiseData[index].FillChannelData(theBuffer);
|
||||
}
|
||||
else // get data from CrossSection directory
|
||||
{
|
||||
G4String tString = "/CrossSection/";
|
||||
active[index] = theIsotopeWiseData[index].Init(A, Z, abundance, theDir, tString);
|
||||
if(active[index]) theBuffer = theIsotopeWiseData[index].MakeChannelData();
|
||||
}
|
||||
if(theBuffer != NULL) Harmonise(theChannelData, theBuffer);
|
||||
}
|
||||
|
||||
void G4NeutronHPChannel::Harmonise(G4NeutronHPVector *& theStore, G4NeutronHPVector * theNew)
|
||||
{
|
||||
G4int s = 0, n=0, i=0, m=0;
|
||||
G4NeutronHPVector * theMerge = new G4NeutronHPVector;
|
||||
G4bool flag;
|
||||
G4NeutronHPVector * anActive = theStore;
|
||||
G4NeutronHPVector * aPassive = theNew;
|
||||
G4NeutronHPVector * tmp;
|
||||
G4int a = s, p = n, t;
|
||||
while (a<anActive->GetVectorLength()&&p<aPassive->GetVectorLength())
|
||||
{
|
||||
if(anActive->GetEnergy(a) <= aPassive->GetEnergy(p))
|
||||
{
|
||||
G4double xa = anActive->GetEnergy(a);
|
||||
theMerge->SetData(m, xa, anActive->GetXsec(a)+aPassive->GetXsec(xa));
|
||||
m++;
|
||||
a++;
|
||||
G4double xp = aPassive->GetEnergy(p);
|
||||
if( abs(abs(xp-xa)/xa)<0.001 )
|
||||
{
|
||||
p++;
|
||||
}
|
||||
} else {
|
||||
tmp = anActive; t=a;
|
||||
anActive = aPassive; a=p;
|
||||
aPassive = tmp; p=t;
|
||||
}
|
||||
}
|
||||
while (a!=anActive->GetVectorLength())
|
||||
{
|
||||
theMerge->SetData(m++, anActive->GetEnergy(a), anActive->GetXsec(a));
|
||||
a++;
|
||||
}
|
||||
while (p!=aPassive->GetVectorLength())
|
||||
{
|
||||
if(abs(theMerge->GetEnergy(max(0,m-1))-aPassive->GetEnergy(p))/aPassive->GetEnergy(p)>0.001)
|
||||
theMerge->SetData(m++, aPassive->GetEnergy(p), aPassive->GetXsec(p));
|
||||
p++;
|
||||
}
|
||||
delete theStore;
|
||||
theStore = theMerge;
|
||||
}
|
||||
|
||||
G4ParticleChange * G4NeutronHPChannel::ApplyYourself(const G4Track & theTrack, G4int anIsotope)
|
||||
{
|
||||
// G4cout << "G4NeutronHPChannel::ApplyYourself+"<<niso<<endl;
|
||||
if(anIsotope != -1) return theFinalStates[anIsotope]->ApplyYourself(theTrack);
|
||||
G4double sum=0;
|
||||
G4int it=0;
|
||||
G4double * xsec = new G4double[niso];
|
||||
for (G4int i=0; i<niso; i++)
|
||||
{
|
||||
if(theFinalStates[i]->HasAnyData())
|
||||
{
|
||||
xsec[i] = theIsotopeWiseData[i].GetXsec(theTrack.GetKineticEnergy());
|
||||
sum += xsec[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
xsec[i]=0;
|
||||
}
|
||||
}
|
||||
if(sum == 0)
|
||||
{
|
||||
// G4cout << "G4NeutronHPChannel::ApplyYourself theFinalState->Initialize+"<<endl;
|
||||
// G4cout << "G4NeutronHPChannel::ApplyYourself theFinalState->Initialize-"<<endl;
|
||||
it = niso*G4UniformRand();
|
||||
}
|
||||
else
|
||||
{
|
||||
// G4cout << "Are we still here? "<<sum<<endl;
|
||||
// G4cout << "TESTHP 23 NISO="<<niso<<endl;
|
||||
G4double random = G4UniformRand();
|
||||
G4double running=0;
|
||||
// G4cout << "G4NeutronHPChannel::ApplyYourself Done the sum"<<niso<<endl;
|
||||
// G4cout << "TESTHP 24 NISO="<<niso<<endl;
|
||||
for (G4int ix=0; ix<niso; ix++)
|
||||
{
|
||||
running += xsec[ix];
|
||||
if(random<=running/sum)
|
||||
{
|
||||
it = ix;
|
||||
goto OUT;
|
||||
}
|
||||
}
|
||||
OUT:
|
||||
if(it==niso) it--;
|
||||
}
|
||||
delete [] xsec;
|
||||
G4ParticleChange * theFinalState=NULL;
|
||||
while(theFinalState==NULL)
|
||||
{
|
||||
// G4cout << "TESTHP 24 it="<<it<<endl;
|
||||
theFinalState = theFinalStates[it]->ApplyYourself(theTrack);
|
||||
}
|
||||
// G4cout <<"THE IMPORTANT RETURN"<<endl;
|
||||
return theFinalState;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,133 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHPChannelList.hh"
|
||||
#include "G4Element.hh"
|
||||
#include "G4ParticleChange.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4NeutronHPFinalState.hh"
|
||||
|
||||
G4int G4NeutronHPChannelList::trycounter = 0;
|
||||
|
||||
G4NeutronHPChannelList::G4NeutronHPChannelList(G4int n)
|
||||
{
|
||||
nChannels = n;
|
||||
theChannels = new G4NeutronHPChannel * [n];
|
||||
allChannelsCreated = false;
|
||||
theInitCount = 0;
|
||||
}
|
||||
|
||||
G4NeutronHPChannelList::G4NeutronHPChannelList()
|
||||
{
|
||||
nChannels = 0;
|
||||
theChannels = NULL;
|
||||
allChannelsCreated = false;
|
||||
theInitCount = 0;
|
||||
}
|
||||
|
||||
G4NeutronHPChannelList::~G4NeutronHPChannelList()
|
||||
{
|
||||
if(theChannels!=NULL)
|
||||
{
|
||||
for(G4int i=0;i<nChannels; i++)
|
||||
{
|
||||
delete theChannels[i];
|
||||
}
|
||||
delete [] theChannels;
|
||||
}
|
||||
}
|
||||
|
||||
G4ParticleChange * G4NeutronHPChannelList::ApplyYourself(const G4Element * anElement, const G4Track & aTrack)
|
||||
{
|
||||
G4int i, ii;
|
||||
// decide on the isotope
|
||||
G4int numberOfIsos;
|
||||
for(ii=0; ii<nChannels; ii++)
|
||||
{
|
||||
numberOfIsos = theChannels[ii]->GetNiso();
|
||||
if(numberOfIsos!=0) break;
|
||||
}
|
||||
G4double * running= new G4double [numberOfIsos];
|
||||
running[0] = 0;
|
||||
for(i=0;i<numberOfIsos; i++)
|
||||
{
|
||||
if(i!=0) running[i] = running[i-1];
|
||||
for(ii=0; ii<nChannels; ii++)
|
||||
{
|
||||
if(theChannels[ii]->HasAnyData(i))
|
||||
{
|
||||
running[i] +=theChannels[ii]->GetWeightedXsec(aTrack.GetKineticEnergy(), i);
|
||||
}
|
||||
}
|
||||
}
|
||||
G4int isotope=nChannels-1;
|
||||
G4double random=G4UniformRand();
|
||||
for(i=0;i<numberOfIsos; i++)
|
||||
{
|
||||
isotope = i;
|
||||
if(random<running[i]/running[numberOfIsos-1]) break;
|
||||
}
|
||||
delete [] running;
|
||||
|
||||
// decide on the channel
|
||||
running = new G4double[nChannels];
|
||||
running[0]=0;
|
||||
for(i=0; i<nChannels; i++)
|
||||
{
|
||||
if(i!=0) running[i] = running[i-1];
|
||||
if(theChannels[i]->HasAnyData(isotope))
|
||||
{
|
||||
running[i] += theChannels[i]->GetFSCrossSection(aTrack.GetKineticEnergy(), isotope);
|
||||
}
|
||||
}
|
||||
G4int lChan=0;
|
||||
random=G4UniformRand();
|
||||
for(i=0; i<nChannels; i++)
|
||||
{
|
||||
lChan = i;
|
||||
if(random<running[i]/running[nChannels-1]) break;
|
||||
}
|
||||
delete [] running;
|
||||
return theChannels[lChan]->ApplyYourself(aTrack, isotope);
|
||||
}
|
||||
|
||||
void G4NeutronHPChannelList::Init(G4Element * anElement, const G4String & dirName)
|
||||
{
|
||||
theDir = dirName;
|
||||
// G4cout << theDir << endl;
|
||||
theElement = anElement;
|
||||
// G4cout << theElement << endl;
|
||||
;
|
||||
}
|
||||
|
||||
void G4NeutronHPChannelList::Register(G4NeutronHPFinalState * theFS,
|
||||
const G4String & aName)
|
||||
{
|
||||
G4bool result;
|
||||
if(!allChannelsCreated)
|
||||
{
|
||||
if(nChannels!=0)
|
||||
{
|
||||
G4NeutronHPChannel ** theBuffer = new G4NeutronHPChannel * [nChannels+1];
|
||||
G4int i;
|
||||
for(i=0; i<nChannels; i++)
|
||||
{
|
||||
theBuffer[i] = theChannels[i];
|
||||
}
|
||||
delete [] theChannels;
|
||||
theChannels = theBuffer;
|
||||
}
|
||||
else
|
||||
{
|
||||
theChannels = new G4NeutronHPChannel * [nChannels+1];
|
||||
}
|
||||
G4String name;
|
||||
name = aName+"/";
|
||||
theChannels[nChannels] = new G4NeutronHPChannel;
|
||||
theChannels[nChannels]->Init(theElement, theDir, name);
|
||||
nChannels++;
|
||||
}
|
||||
result = theChannels[theInitCount]->Register(theFS);
|
||||
theInitCount++;
|
||||
}
|
||||
@@ -0,0 +1,353 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHPContAngularPar.hh"
|
||||
#include "G4NeutronHPLegendreStore.hh"
|
||||
#include "G4Gamma.hh"
|
||||
#include "G4Electron.hh"
|
||||
#include "G4Positron.hh"
|
||||
#include "G4Neutron.hh"
|
||||
#include "G4Proton.hh"
|
||||
#include "G4Deuteron.hh"
|
||||
#include "G4Triton.hh"
|
||||
#include "G4He3.hh"
|
||||
#include "G4Alpha.hh"
|
||||
#include "G4NeutronHPVector.hh"
|
||||
#include "G4NucleiPropertiesTable.hh"
|
||||
#include "G4NeutronHPKallbachMannSyst.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
|
||||
void G4NeutronHPContAngularPar::Init(ifstream & aDataFile)
|
||||
{
|
||||
aDataFile >> theEnergy >> nEnergies >> nDiscreteEnergies >> nAngularParameters;
|
||||
theEnergy *= eV;
|
||||
theAngular = new G4NeutronHPList [nEnergies];
|
||||
for(G4int i=0; i<nEnergies; i++)
|
||||
{
|
||||
G4double sEnergy;
|
||||
aDataFile >> sEnergy;
|
||||
sEnergy*=eV;
|
||||
theAngular[i].SetLabel(sEnergy);
|
||||
theAngular[i].Init(aDataFile, nAngularParameters, 1.);
|
||||
}
|
||||
}
|
||||
|
||||
G4ReactionProduct *
|
||||
G4NeutronHPContAngularPar::Sample(G4double anEnergy, G4double massCode, G4double targetMass,
|
||||
G4int angularRep, G4int interpolE)
|
||||
{
|
||||
G4ReactionProduct * result = new G4ReactionProduct;
|
||||
G4int Z = massCode/1000;
|
||||
G4int A = massCode-1000*Z;
|
||||
if(massCode==0)
|
||||
{
|
||||
result->SetDefinition(G4Gamma::Gamma());
|
||||
}
|
||||
else if(A==0)
|
||||
{
|
||||
result->SetDefinition(G4Electron::Electron());
|
||||
if(Z==1) result->SetDefinition(G4Positron::Positron());
|
||||
}
|
||||
else if(A==1)
|
||||
{
|
||||
result->SetDefinition(G4Neutron::Neutron());
|
||||
if(Z==1) result->SetDefinition(G4Proton::Proton());
|
||||
}
|
||||
else if(A==2)
|
||||
{
|
||||
result->SetDefinition(G4Deuteron::Deuteron());
|
||||
}
|
||||
else if(A==3)
|
||||
{
|
||||
result->SetDefinition(G4Triton::Triton());
|
||||
if(Z==2) result->SetDefinition(G4He3::He3());
|
||||
}
|
||||
else if(A==4)
|
||||
{
|
||||
result->SetDefinition(G4Alpha::Alpha());
|
||||
if(Z!=2) G4Exception("G4NeutronHPContAngularPar: Unknown ion case 1");
|
||||
}
|
||||
else
|
||||
{
|
||||
result->SetDefinition(G4ParticleTable::GetParticleTable()->FindIon(Z,A,0,Z));
|
||||
}
|
||||
G4int i;
|
||||
G4int it;
|
||||
G4double fsEnergy;
|
||||
G4double cosTh;
|
||||
if(angularRep==1)
|
||||
{
|
||||
G4double random = G4UniformRand();
|
||||
G4double * running = new G4double[nEnergies];
|
||||
running[0]=0;
|
||||
G4double weighted = 0;
|
||||
for(i=1; i<nEnergies; i++)
|
||||
{
|
||||
if(i!=0)
|
||||
{
|
||||
running[i]=running[i-1];
|
||||
}
|
||||
running[i] += theInt.GetBinIntegral(theManager.GetScheme(i-1),
|
||||
theAngular[i-1].GetLabel(), theAngular[i].GetLabel(),
|
||||
theAngular[i-1].GetValue(0), theAngular[i].GetValue(0));
|
||||
weighted += theInt.GetWeightedBinIntegral(theManager.GetScheme(i-1),
|
||||
theAngular[i-1].GetLabel(), theAngular[i].GetLabel(),
|
||||
theAngular[i-1].GetValue(0), theAngular[i].GetValue(0));
|
||||
}
|
||||
// cash the mean energy in this distribution
|
||||
currentMeanEnergy = weighted/running[nEnergies-1];
|
||||
|
||||
for(i=0; i<nEnergies; i++)
|
||||
{
|
||||
it = i;
|
||||
if(random<running[i]/running[nEnergies-1]) break;
|
||||
}
|
||||
if(it<nDiscreteEnergies||it==0)
|
||||
{
|
||||
if(it == 0)
|
||||
{
|
||||
fsEnergy = theAngular[it].GetLabel();
|
||||
G4NeutronHPLegendreStore theStore(1);
|
||||
theStore.Init(0,fsEnergy,nAngularParameters);
|
||||
for(i=0;i<nAngularParameters;i++)
|
||||
{
|
||||
theStore.SetCoeff(0,i,theAngular[it].GetValue(i));
|
||||
}
|
||||
// use it to sample.
|
||||
cosTh = theStore.SampleMax(fsEnergy);
|
||||
}
|
||||
else
|
||||
{
|
||||
G4double e1, e2;
|
||||
e1 = theAngular[it].GetLabel();
|
||||
e2 = theAngular[it-1].GetLabel();
|
||||
fsEnergy = theInt.Interpolate(theManager.GetInverseScheme(it),
|
||||
random,
|
||||
running[it-1]/running[nEnergies-1],
|
||||
running[it]/running[nEnergies-1],
|
||||
e1, e2);
|
||||
// fill a Legendrestore
|
||||
G4NeutronHPLegendreStore theStore(2);
|
||||
theStore.Init(0,e1,nAngularParameters);
|
||||
theStore.Init(1,e2,nAngularParameters);
|
||||
for(i=0;i<nAngularParameters;i++)
|
||||
{
|
||||
theStore.SetCoeff(0,i,theAngular[it-1].GetValue(i));
|
||||
theStore.SetCoeff(1,i,theAngular[it].GetValue(i));
|
||||
}
|
||||
// use it to sample.
|
||||
theStore.SetManager(theManager);
|
||||
cosTh = theStore.SampleMax(fsEnergy);
|
||||
}
|
||||
}
|
||||
else // continuum contribution
|
||||
{
|
||||
G4double x1 = running[it-1]/running[nEnergies-1];
|
||||
G4double x2 = running[it]/running[nEnergies-1];
|
||||
G4double y1 = theAngular[it-1].GetLabel();
|
||||
G4double y2 = theAngular[it].GetLabel();
|
||||
fsEnergy = theInt.Interpolate(theManager.GetInverseScheme(it),
|
||||
random,x1,x2,y1,y2);
|
||||
G4NeutronHPLegendreStore theStore(2);
|
||||
theStore.Init(0,y1,nAngularParameters);
|
||||
theStore.Init(1,y2,nAngularParameters);
|
||||
theStore.SetManager(theManager);
|
||||
for(i=0;i<nAngularParameters;i++)
|
||||
{
|
||||
theStore.SetCoeff(0,i,theAngular[it-1].GetValue(i));
|
||||
theStore.SetCoeff(1,i,theAngular[it].GetValue(i));
|
||||
}
|
||||
// use it to sample.
|
||||
cosTh = theStore.SampleMax(fsEnergy);
|
||||
}
|
||||
delete [] running;
|
||||
}
|
||||
else if(angularRep==2)
|
||||
{
|
||||
// first get the energy (already the right for this incoming energy)
|
||||
G4int i;
|
||||
G4double * running = new G4double[nEnergies];
|
||||
running[0]=0;
|
||||
G4double weighted = 0;
|
||||
for(i=1; i<nEnergies; i++)
|
||||
{
|
||||
if(i!=0) running[i]=running[i-1];
|
||||
running[i] += theInt.GetBinIntegral(theManager.GetScheme(i-1),
|
||||
theAngular[i-1].GetLabel(), theAngular[i].GetLabel(),
|
||||
theAngular[i-1].GetValue(0), theAngular[i].GetValue(0));
|
||||
weighted += theInt.GetWeightedBinIntegral(theManager.GetScheme(i-1),
|
||||
theAngular[i-1].GetLabel(), theAngular[i].GetLabel(),
|
||||
theAngular[i-1].GetValue(0), theAngular[i].GetValue(0));
|
||||
}
|
||||
// cash the mean energy in this distribution
|
||||
currentMeanEnergy = weighted/running[nEnergies-1];
|
||||
|
||||
G4int it;
|
||||
G4double randkal = G4UniformRand();
|
||||
for(i=0; i<nEnergies; i++)
|
||||
{
|
||||
it = i;
|
||||
if(randkal<running[i]/running[nEnergies-1]) break;
|
||||
}
|
||||
|
||||
// interpolate the secondary energy.
|
||||
G4double x, x1,x2,y1,y2;
|
||||
if(it==0) it=1;
|
||||
x = randkal*running[nEnergies-1];
|
||||
x1 = running[it-1];
|
||||
x2 = running[it];
|
||||
G4double compoundFraction;
|
||||
// interpolate energy
|
||||
y1 = theAngular[it-1].GetLabel();
|
||||
y2 = theAngular[it].GetLabel();
|
||||
fsEnergy = theInt.Interpolate(theManager.GetInverseScheme(it-1),
|
||||
x, x1,x2,y1,y2);
|
||||
// for theta interpolate the compoundFractions
|
||||
G4double cLow = theAngular[it-1].GetValue(1);
|
||||
G4double cHigh = theAngular[it].GetValue(1);
|
||||
compoundFraction = theInt.Interpolate(theManager.GetScheme(it),
|
||||
fsEnergy, y1, y2, cLow,cHigh);
|
||||
delete [] running;
|
||||
|
||||
// get cosTh
|
||||
G4double incidentEnergy = anEnergy;
|
||||
G4double incidentMass = G4Neutron::Neutron()->GetPDGMass();
|
||||
G4double productEnergy = fsEnergy;
|
||||
G4double productMass = result->GetMass();
|
||||
G4int targetZ = G4int(theTargetCode/1000);
|
||||
G4int targetA = G4int(theTargetCode-1000*targetZ);
|
||||
G4double targetMass = theTarget->GetMass();
|
||||
G4int residualA = targetA+1-A;
|
||||
G4int residualZ = targetZ-Z;
|
||||
G4double residualMass = residualZ*G4Proton::Proton()->GetPDGMass();
|
||||
residualMass +=(residualA-residualZ)*G4Neutron::Neutron()->GetPDGMass();
|
||||
residualMass -= G4NucleiPropertiesTable::GetBindingEnergy(residualZ, residualA);
|
||||
G4NeutronHPKallbachMannSyst theKallbach(compoundFraction,
|
||||
incidentEnergy, incidentMass,
|
||||
productEnergy, productMass,
|
||||
residualMass, residualA, residualZ,
|
||||
targetMass, targetA, targetZ);
|
||||
cosTh = theKallbach.Sample(anEnergy);
|
||||
}
|
||||
else if(angularRep>10&&angularRep<16)
|
||||
{
|
||||
G4double random = G4UniformRand();
|
||||
G4double * running = new G4double[nEnergies];
|
||||
running[0]=0;
|
||||
G4double weighted = 0;
|
||||
for(i=1; i<nEnergies; i++)
|
||||
{
|
||||
if(i!=0) running[i]=running[i-1];
|
||||
running[i] += theInt.GetBinIntegral(theManager.GetScheme(i-1),
|
||||
theAngular[i-1].GetLabel(), theAngular[i].GetLabel(),
|
||||
theAngular[i-1].GetValue(0), theAngular[i].GetValue(0));
|
||||
weighted += theInt.GetWeightedBinIntegral(theManager.GetScheme(i-1),
|
||||
theAngular[i-1].GetLabel(), theAngular[i].GetLabel(),
|
||||
theAngular[i-1].GetValue(0), theAngular[i].GetValue(0));
|
||||
}
|
||||
// cash the mean energy in this distribution
|
||||
currentMeanEnergy = weighted/running[nEnergies-1];
|
||||
|
||||
for(i=0; i<nEnergies; i++)
|
||||
{
|
||||
it = i;
|
||||
if(random<running[i]/running[nEnergies-1]) break;
|
||||
}
|
||||
if(it<nDiscreteEnergies||it==0)
|
||||
{
|
||||
if(it==0)
|
||||
{
|
||||
fsEnergy = theAngular[0].GetLabel();
|
||||
G4NeutronHPVector theStore;
|
||||
G4int aCounter = 0;
|
||||
for(G4int i=1; i<nAngularParameters; i+=2)
|
||||
{
|
||||
theStore.SetX(aCounter, theAngular[0].GetValue(i));
|
||||
theStore.SetY(aCounter, theAngular[0].GetValue(i+1));
|
||||
aCounter++;
|
||||
}
|
||||
G4InterpolationManager aMan;
|
||||
aMan.Init(angularRep-10, nAngularParameters-1);
|
||||
theStore.SetInterpolationManager(aMan);
|
||||
cosTh = theStore.Sample();
|
||||
}
|
||||
else
|
||||
{
|
||||
fsEnergy = theAngular[it].GetLabel();
|
||||
G4NeutronHPVector theStore;
|
||||
G4InterpolationManager aMan;
|
||||
aMan.Init(angularRep-10, nAngularParameters-1);
|
||||
theStore.SetInterpolationManager(aMan); // Store interpolates f(costh)
|
||||
G4InterpolationScheme currentScheme = theManager.GetInverseScheme(it);
|
||||
G4int aCounter = 0;
|
||||
for(G4int i=1; i<nAngularParameters; i+=2)
|
||||
{
|
||||
theStore.SetX(aCounter, theAngular[it].GetValue(i));
|
||||
theStore.SetY(aCounter, theInt.Interpolate(currentScheme,
|
||||
random,
|
||||
running[it-1]/running[nEnergies-1],
|
||||
running[it]/running[nEnergies-1],
|
||||
theAngular[it-1].GetValue(i+1),
|
||||
theAngular[it].GetValue(i+1)));
|
||||
aCounter++;
|
||||
}
|
||||
cosTh = theStore.Sample();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
G4double x1 = running[it-1]/running[nEnergies-1];
|
||||
G4double x2 = running[it]/running[nEnergies-1];
|
||||
G4double y1 = theAngular[it-1].GetLabel();
|
||||
G4double y2 = theAngular[it].GetLabel();
|
||||
fsEnergy = theInt.Interpolate(theManager.GetInverseScheme(it),
|
||||
random,x1,x2,y1,y2);
|
||||
G4NeutronHPVector theBuff1;
|
||||
G4NeutronHPVector theBuff2;
|
||||
G4InterpolationManager aMan;
|
||||
aMan.Init(angularRep-10, nAngularParameters-1);
|
||||
// theBuff1.SetInterpolationManager(aMan); // Store interpolates f(costh)
|
||||
// theBuff2.SetInterpolationManager(aMan); // Store interpolates f(costh)
|
||||
for(i=0; i<nAngularParameters; i++) // i=1 ist wichtig!
|
||||
{
|
||||
theBuff1.SetX(i, theAngular[it-1].GetValue(i));
|
||||
theBuff1.SetY(i, theAngular[it-1].GetValue(i+1));
|
||||
theBuff2.SetX(i, theAngular[it].GetValue(i));
|
||||
theBuff2.SetY(i, theAngular[it].GetValue(i+1));
|
||||
i++;
|
||||
}
|
||||
G4NeutronHPVector theStore;
|
||||
theStore.SetInterpolationManager(aMan); // Store interpolates f(costh)
|
||||
x1 = y1;
|
||||
x2 = y2;
|
||||
G4double x, y;
|
||||
for(i=0;i<theBuff1.GetVectorLength(); i++);
|
||||
{
|
||||
x = theBuff1.GetX(i); // costh binning identical
|
||||
y1 = theBuff1.GetY(i);
|
||||
y2 = theBuff2.GetY(i);
|
||||
y = theInt.Interpolate(theManager.GetScheme(it),
|
||||
fsEnergy, theAngular[it-1].GetLabel(),
|
||||
theAngular[it].GetLabel(), y1, y2);
|
||||
theStore.SetX(i, x);
|
||||
theStore.SetY(i, y);
|
||||
}
|
||||
cosTh = theStore.Sample();
|
||||
}
|
||||
delete [] running;
|
||||
}
|
||||
else
|
||||
{
|
||||
G4Exception("G4NeutronHPContAngularPar::Sample: Unknown angular representation");
|
||||
}
|
||||
result->SetKineticEnergy(fsEnergy);
|
||||
G4double phi = twopi*G4UniformRand();
|
||||
G4double theta = acos(cosTh);
|
||||
G4double sinth = sin(theta);
|
||||
G4double mtot = result->GetTotalMomentum();
|
||||
G4ThreeVector tempVector(mtot*sinth*cos(phi), mtot*sinth*sin(phi), mtot*cos(theta) );
|
||||
result->SetMomentum(tempVector);
|
||||
// return the result.
|
||||
return result;
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHPContEnergyAngular.hh"
|
||||
|
||||
G4ReactionProduct * G4NeutronHPContEnergyAngular::Sample(G4double anEnergy, G4double massCode, G4double mass)
|
||||
{
|
||||
G4ReactionProduct * result;
|
||||
G4int i,ii,iii;
|
||||
G4int it;
|
||||
for(i=0;i<nEnergy;i++)
|
||||
{
|
||||
it = i;
|
||||
if(theAngular[i].GetEnergy()>anEnergy) break;
|
||||
}
|
||||
G4double targetMass = GetTarget()->GetMass();
|
||||
if(it==0)
|
||||
{
|
||||
theAngular[0].SetTarget(GetTarget());
|
||||
theAngular[0].SetTargetCode(theTargetCode);
|
||||
theAngular[0].SetPrimary(GetNeutron());
|
||||
result = theAngular[0].Sample(anEnergy, massCode, targetMass,
|
||||
theAngularRep, theInterpolation);
|
||||
currentMeanEnergy = theAngular[0].MeanEnergyOfThisInteraction();
|
||||
}
|
||||
else
|
||||
{
|
||||
// interpolation through alternating sampling. This needs improvement @@@
|
||||
G4double random = G4UniformRand();
|
||||
G4double deltaE = theAngular[it].GetEnergy()-theAngular[it-1].GetEnergy();
|
||||
G4double offset = theAngular[it].GetEnergy()-anEnergy;
|
||||
if(random<offset/deltaE) it--;
|
||||
theAngular[it].SetTarget(GetTarget());
|
||||
theAngular[it].SetTargetCode(theTargetCode);
|
||||
theAngular[it].SetPrimary(GetNeutron());
|
||||
result = theAngular[it].Sample(anEnergy, massCode, targetMass,
|
||||
theAngularRep, theInterpolation);
|
||||
currentMeanEnergy = theAngular[it].MeanEnergyOfThisInteraction();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
G4double G4NeutronHPContEnergyAngular::
|
||||
MeanEnergyOfThisInteraction()
|
||||
{
|
||||
G4double result;
|
||||
if(currentMeanEnergy<-1)
|
||||
{
|
||||
G4Exception("G4NeutronHPContEnergyAngular: Logical error in Product class");
|
||||
}
|
||||
else
|
||||
{
|
||||
result = currentMeanEnergy;
|
||||
}
|
||||
currentMeanEnergy = -2;
|
||||
return result;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHPD2AInelasticFS.hh"
|
||||
#include "G4Nucleus.hh"
|
||||
#include "G4Alpha.hh"
|
||||
#include "G4Deuteron.hh"
|
||||
|
||||
G4ParticleChange * G4NeutronHPD2AInelasticFS::ApplyYourself(const G4Track & theTrack)
|
||||
{
|
||||
// these are the particle types in the final state
|
||||
|
||||
G4ParticleDefinition * theDefs[3];
|
||||
theDefs[0] = G4Deuteron::Deuteron();
|
||||
theDefs[1] = G4Alpha::Alpha();
|
||||
theDefs[2] = G4Alpha::Alpha();
|
||||
|
||||
// fill the final state
|
||||
G4NeutronHPInelasticBaseFS::BaseApply(theTrack, theDefs, 3);
|
||||
|
||||
// return the result
|
||||
return &theResult;
|
||||
}
|
||||
|
||||
void G4NeutronHPD2AInelasticFS::
|
||||
Init (G4double A, G4double Z, G4String & dirName, G4String & aFSType)
|
||||
{
|
||||
G4NeutronHPInelasticBaseFS::Init(A, Z, dirName, aFSType);
|
||||
G4double ResidualA = A-9;
|
||||
G4double ResidualZ = Z-5;
|
||||
G4NeutronHPInelasticBaseFS::InitGammas(ResidualA, ResidualZ);
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHPDAInelasticFS.hh"
|
||||
#include "G4Nucleus.hh"
|
||||
#include "G4Deuteron.hh"
|
||||
#include "G4Alpha.hh"
|
||||
|
||||
G4ParticleChange * G4NeutronHPDAInelasticFS::ApplyYourself(const G4Track & theTrack)
|
||||
{
|
||||
// these are the particle types in the final state
|
||||
|
||||
G4ParticleDefinition * theDefs[2];
|
||||
theDefs[0] = G4Deuteron::Deuteron();
|
||||
theDefs[1] = G4Alpha::Alpha();
|
||||
|
||||
// fill the final state
|
||||
G4NeutronHPInelasticBaseFS::BaseApply(theTrack, theDefs, 2);
|
||||
|
||||
// return the result
|
||||
return &theResult;
|
||||
}
|
||||
|
||||
void G4NeutronHPDAInelasticFS::
|
||||
Init (G4double A, G4double Z, G4String & dirName, G4String & aFSType)
|
||||
{
|
||||
G4NeutronHPInelasticBaseFS::Init(A, Z, dirName, aFSType);
|
||||
G4double ResidualA = A-5;
|
||||
G4double ResidualZ = Z-3;
|
||||
G4NeutronHPInelasticBaseFS::InitGammas(ResidualA, ResidualZ);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHPDInelasticFS.hh"
|
||||
#include "G4Nucleus.hh"
|
||||
#include "G4Deuteron.hh"
|
||||
|
||||
void G4NeutronHPDInelasticFS::Init (G4double A, G4double Z, G4String & dirName, G4String & aFSType)
|
||||
{
|
||||
G4NeutronHPInelasticCompFS::Init(A, Z, dirName, aFSType);
|
||||
G4double ResidualA = A-1;
|
||||
G4double ResidualZ = Z-1;
|
||||
G4NeutronHPInelasticCompFS::InitGammas(ResidualA, ResidualZ);
|
||||
}
|
||||
|
||||
G4ParticleChange * G4NeutronHPDInelasticFS::ApplyYourself(const G4Track & theTrack)
|
||||
{
|
||||
|
||||
// do the final state
|
||||
G4NeutronHPInelasticCompFS::CompositeApply(theTrack, G4Deuteron::Deuteron());
|
||||
|
||||
// return the result
|
||||
return &theResult;
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHPData.hh"
|
||||
#include "G4LPhysicsFreeVector.hh"
|
||||
|
||||
G4NeutronHPData * G4NeutronHPData::theCrossSectionData = NULL;
|
||||
|
||||
G4NeutronHPData::G4NeutronHPData()
|
||||
{
|
||||
numEle = G4Element::GetNumberOfElements();
|
||||
theData = new G4NeutronHPElementData[numEle];
|
||||
// G4cout << "G4NeutronHPData::G4NeutronHPData(): numEle="<<numEle<<endl;
|
||||
for (G4int i=0; i<numEle; i++)
|
||||
{
|
||||
theData[i].Init((*(G4Element::GetElementTable()))(i));
|
||||
}
|
||||
}
|
||||
|
||||
G4NeutronHPData::~G4NeutronHPData()
|
||||
{
|
||||
delete [] theData;
|
||||
}
|
||||
|
||||
G4PhysicsVector * G4NeutronHPData::DoPhysicsVector(G4NeutronHPVector * theVector)
|
||||
{
|
||||
// G4cout << "Entered G4NeutronHPData::DoPhysicsVector."<<endl;
|
||||
G4int len = theVector->GetVectorLength();
|
||||
// G4cout <<"zahl der energie-punkte "<< len<<endl;
|
||||
if(len==0) return new G4LPhysicsFreeVector(0, 0, 0);
|
||||
G4double emin = theVector->GetX(0);
|
||||
G4double emax = theVector->GetX(len-1);
|
||||
// G4cout <<"zahl der energie-punkte "<< len<<" "<<emin<<" "<<emax<<endl;
|
||||
|
||||
// G4int dummy; cin >> dummy;
|
||||
G4bool flag;
|
||||
|
||||
G4LPhysicsFreeVector * theResult = new G4LPhysicsFreeVector(len, emin, emax);
|
||||
for (G4int i=0; i<len; i++)
|
||||
{
|
||||
theResult->PutValues(i, theVector->GetX(i), theVector->GetY(i));
|
||||
}
|
||||
return theResult;
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHPDeExGammas.hh"
|
||||
|
||||
void G4NeutronHPDeExGammas::Init(ifstream & aDataFile)
|
||||
{
|
||||
G4NeutronHPGamma ** theGammas = new G4NeutronHPGamma * [50];
|
||||
G4int nGammas = 0;
|
||||
G4int nBuff = 50;
|
||||
for(;;)
|
||||
{
|
||||
G4NeutronHPGamma * theNew = new G4NeutronHPGamma;
|
||||
if(!theNew->Init(aDataFile))
|
||||
{
|
||||
delete theNew;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(nGammas==nBuff)
|
||||
{
|
||||
nBuff+=50;
|
||||
G4NeutronHPGamma ** buffer = new G4NeutronHPGamma * [nBuff];
|
||||
for(G4int i=0;i<nGammas;i++) buffer[i] = theGammas[i];
|
||||
delete [] theGammas;
|
||||
theGammas = buffer;
|
||||
}
|
||||
theGammas[nGammas] = theNew;
|
||||
nGammas++;
|
||||
}
|
||||
}
|
||||
// all gammas are in. Now sort them into levels.
|
||||
|
||||
// count the levels
|
||||
|
||||
G4double currentE = 0;
|
||||
G4double nextE = 0;
|
||||
G4int i;
|
||||
G4double epsilon = 0.01*keV;
|
||||
for(i=0; i<nGammas; i++)
|
||||
{
|
||||
nextE = theGammas[i]->GetLevelEnergy();
|
||||
if(abs(currentE-nextE)>epsilon) nLevels++;
|
||||
currentE = nextE;
|
||||
}
|
||||
|
||||
// Build the levels
|
||||
|
||||
theLevels = new G4NeutronHPLevel[nLevels];
|
||||
levelStart = new G4int [nLevels];
|
||||
levelSize = new G4int [nLevels];
|
||||
|
||||
// fill the levels
|
||||
|
||||
currentE = 0;
|
||||
nextE = 0;
|
||||
G4int levelCounter=-1;
|
||||
for(i=0; i<nGammas; i++)
|
||||
{
|
||||
nextE = theGammas[i]->GetLevelEnergy();
|
||||
if(abs(currentE-nextE)>epsilon)
|
||||
{
|
||||
levelCounter++;
|
||||
levelStart[levelCounter] = i;
|
||||
levelSize[levelCounter] = 0;
|
||||
}
|
||||
levelSize[levelCounter]++;
|
||||
currentE = nextE;
|
||||
}
|
||||
|
||||
for(i=0; i<nLevels; i++)
|
||||
{
|
||||
theLevels[i].SetNumberOfGammas(levelSize[i]);
|
||||
for(G4int ii=levelStart[i]; ii<levelStart[i]+levelSize[i]; ii++)
|
||||
{
|
||||
theLevels[i].SetGamma(ii-levelStart[i], theGammas[ii]);
|
||||
}
|
||||
}
|
||||
|
||||
// set the next relation in the gammas.
|
||||
G4double levelE, gammaE, currentLevelE;
|
||||
G4double min;
|
||||
for(i=0; i<nGammas; i++)
|
||||
{
|
||||
G4int it=-1;
|
||||
gammaE = theGammas[i]->GetGammaEnergy();
|
||||
currentLevelE = theGammas[i]->GetLevelEnergy();
|
||||
min = currentLevelE-gammaE-epsilon;
|
||||
for(G4int ii=0; ii<nLevels; ii++)
|
||||
{
|
||||
levelE = theLevels[ii].GetLevelEnergy();
|
||||
if(abs(currentLevelE-(levelE+gammaE))<min)
|
||||
{
|
||||
min = abs(currentLevelE-(levelE+gammaE));
|
||||
it = ii;
|
||||
}
|
||||
}
|
||||
if(it!=-1) theGammas[i]->SetNext(&theLevels[it]);
|
||||
}
|
||||
// some garbage collection
|
||||
|
||||
delete [] theGammas;
|
||||
|
||||
// and we are Done.
|
||||
}
|
||||
@@ -0,0 +1,262 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHPDiscreteTwoBody.hh"
|
||||
#include "G4Gamma.hh"
|
||||
#include "G4Electron.hh"
|
||||
#include "G4Positron.hh"
|
||||
#include "G4Neutron.hh"
|
||||
#include "G4Proton.hh"
|
||||
#include "G4Deuteron.hh"
|
||||
#include "G4Triton.hh"
|
||||
#include "G4He3.hh"
|
||||
#include "G4Alpha.hh"
|
||||
#include "G4NeutronHPVector.hh"
|
||||
#include "G4NeutronHPLegendreStore.hh"
|
||||
|
||||
G4ReactionProduct * G4NeutronHPDiscreteTwoBody::Sample(G4double anEnergy, G4double massCode, G4double mass)
|
||||
{ // Interpolation still only for the most used parts; rest to be Done @@@@@
|
||||
G4ReactionProduct * result = new G4ReactionProduct;
|
||||
G4int Z = massCode/1000;
|
||||
G4int A = massCode-1000*Z;
|
||||
|
||||
if(massCode==0)
|
||||
{
|
||||
result->SetDefinition(G4Gamma::Gamma());
|
||||
}
|
||||
else if(A==0)
|
||||
{
|
||||
result->SetDefinition(G4Electron::Electron());
|
||||
if(Z==1) result->SetDefinition(G4Positron::Positron());
|
||||
}
|
||||
else if(A==1)
|
||||
{
|
||||
result->SetDefinition(G4Neutron::Neutron());
|
||||
if(Z==1) result->SetDefinition(G4Proton::Proton());
|
||||
}
|
||||
else if(A==2)
|
||||
{
|
||||
result->SetDefinition(G4Deuteron::Deuteron());
|
||||
}
|
||||
else if(A==3)
|
||||
{
|
||||
result->SetDefinition(G4Triton::Triton());
|
||||
if(Z==2) result->SetDefinition(G4He3::He3());
|
||||
}
|
||||
else if(A==4)
|
||||
{
|
||||
result->SetDefinition(G4Alpha::Alpha());
|
||||
if(Z!=2) G4Exception("Unknown ion case 1");
|
||||
}
|
||||
else
|
||||
{
|
||||
G4Exception("G4NeutronHPDiscreteTwoBody: Unknown ion case 2");
|
||||
}
|
||||
|
||||
// get cosine(theta)
|
||||
G4int i, it;
|
||||
G4double cosTh;
|
||||
for(i=0; i<nEnergy; i++)
|
||||
{
|
||||
it = i;
|
||||
if(theCoeff[i].GetEnergy()>anEnergy) break;
|
||||
}
|
||||
if(it==0||it==nEnergy-1)
|
||||
{
|
||||
if(theCoeff[it].GetRepresentation()==0)
|
||||
{
|
||||
G4NeutronHPLegendreStore theStore(1);
|
||||
theStore.SetCoeff(0, theCoeff);
|
||||
theStore.SetManager(theManager);
|
||||
cosTh = theStore.SampleMax(anEnergy);
|
||||
}
|
||||
else if(theCoeff[it].GetRepresentation()==12) // means LINLIN
|
||||
{
|
||||
G4NeutronHPVector theStore;
|
||||
G4InterpolationManager aManager;
|
||||
aManager.Init(LINLIN, theCoeff[it].GetNumberOfPoly()/2);
|
||||
theStore.SetInterpolationManager(aManager);
|
||||
for(i=0;i<theCoeff[it].GetNumberOfPoly(); i++)
|
||||
{
|
||||
theStore.SetX(i, theCoeff[it].GetCoeff(i));
|
||||
theStore.SetY(i, theCoeff[it].GetCoeff(i));
|
||||
i++;
|
||||
}
|
||||
cosTh = theStore.Sample();
|
||||
}
|
||||
else if(theCoeff[it].GetRepresentation()==14) //this is LOGLIN
|
||||
{
|
||||
G4NeutronHPVector theStore;
|
||||
G4InterpolationManager aManager;
|
||||
aManager.Init(LOGLIN, theCoeff[it].GetNumberOfPoly()/2);
|
||||
theStore.SetInterpolationManager(aManager);
|
||||
for(i=0;i<theCoeff[it].GetNumberOfPoly(); i++)
|
||||
{
|
||||
theStore.SetX(i, theCoeff[it].GetCoeff(i));
|
||||
theStore.SetY(i, theCoeff[it].GetCoeff(i));
|
||||
i++;
|
||||
}
|
||||
cosTh = theStore.Sample();
|
||||
}
|
||||
else
|
||||
{
|
||||
G4Exception("unknown representation type in Two-body scattering");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(theCoeff[it].GetRepresentation() == theCoeff[it-1].GetRepresentation())
|
||||
{
|
||||
if(theCoeff[it].GetRepresentation()==0)
|
||||
{
|
||||
G4NeutronHPLegendreStore theStore(2);
|
||||
theStore.SetCoeff(0, &(theCoeff[it-1]));
|
||||
theStore.SetCoeff(1, &(theCoeff[it]));
|
||||
G4InterpolationManager aManager;
|
||||
aManager.Init(theManager.GetScheme(it), 2);
|
||||
theStore.SetManager(aManager);
|
||||
cosTh = theStore.SampleMax(anEnergy);
|
||||
}
|
||||
else if(theCoeff[it].GetRepresentation()==12) // LINLIN
|
||||
{
|
||||
G4NeutronHPVector theBuff1;
|
||||
G4InterpolationManager aManager1;
|
||||
aManager1.Init(LINLIN, theCoeff[it-1].GetNumberOfPoly()/2);
|
||||
theBuff1.SetInterpolationManager(aManager1);
|
||||
for(i=0;i<theCoeff[it-1].GetNumberOfPoly(); i++)
|
||||
{
|
||||
theBuff1.SetX(i, theCoeff[it-1].GetCoeff(i));
|
||||
theBuff1.SetY(i, theCoeff[it-1].GetCoeff(i));
|
||||
i++;
|
||||
}
|
||||
G4NeutronHPVector theBuff2;
|
||||
G4InterpolationManager aManager2;
|
||||
aManager2.Init(LINLIN, theCoeff[it].GetNumberOfPoly()/2);
|
||||
theBuff2.SetInterpolationManager(aManager2);
|
||||
for(i=0;i<theCoeff[it].GetNumberOfPoly(); i++)
|
||||
{
|
||||
theBuff2.SetX(i, theCoeff[it].GetCoeff(i));
|
||||
theBuff2.SetY(i, theCoeff[it].GetCoeff(i));
|
||||
i++;
|
||||
}
|
||||
|
||||
G4double x1 = theCoeff[it-1].GetEnergy();
|
||||
G4double x2 = theCoeff[it].GetEnergy();
|
||||
G4double x = anEnergy;
|
||||
G4double y1, y2, y, mu;
|
||||
|
||||
G4NeutronHPVector theStore1;
|
||||
theStore1.SetInterpolationManager(aManager1);
|
||||
G4NeutronHPVector theStore2;
|
||||
theStore2.SetInterpolationManager(aManager2);
|
||||
G4NeutronHPVector theStore;
|
||||
|
||||
// for fixed mu get p1, p2 and interpolate according to x
|
||||
for(i=0; i<theBuff1.GetVectorLength(); i++)
|
||||
{
|
||||
mu = theBuff1.GetX(i);
|
||||
y1 = theBuff1.GetY(i);
|
||||
y2 = theBuff2.GetY(mu);
|
||||
y = theInt.Interpolate(theManager.GetScheme(it), x, x1,x2,y1,y2);
|
||||
theStore1.SetData(i, mu, y);
|
||||
}
|
||||
for(i=0; i<theBuff2.GetVectorLength(); i++)
|
||||
{
|
||||
mu = theBuff2.GetX(i);
|
||||
y1 = theBuff2.GetY(i);
|
||||
y2 = theBuff1.GetY(mu);
|
||||
y = theInt.Interpolate(theManager.GetScheme(it), x, x1,x2,y1,y2);
|
||||
theStore2.SetData(i, mu, y);
|
||||
}
|
||||
theStore.Merge(&theStore1, &theStore2); // merge takes care of interpolationschemes
|
||||
cosTh = theStore.Sample();
|
||||
}
|
||||
else if(theCoeff[it].GetRepresentation()==14)
|
||||
{
|
||||
G4NeutronHPVector theBuff1;
|
||||
G4InterpolationManager aManager1;
|
||||
aManager1.Init(LOGLIN, theCoeff[it-1].GetNumberOfPoly()/2);
|
||||
theBuff1.SetInterpolationManager(aManager1);
|
||||
for(i=0;i<theCoeff[it-1].GetNumberOfPoly(); i++)
|
||||
{
|
||||
theBuff1.SetX(i, theCoeff[it-1].GetCoeff(i));
|
||||
theBuff1.SetY(i, theCoeff[it-1].GetCoeff(i));
|
||||
i++;
|
||||
}
|
||||
|
||||
G4NeutronHPVector theBuff2;
|
||||
G4InterpolationManager aManager2;
|
||||
aManager2.Init(LOGLIN, theCoeff[it].GetNumberOfPoly()/2);
|
||||
theBuff2.SetInterpolationManager(aManager2);
|
||||
for(i=0;i<theCoeff[it].GetNumberOfPoly(); i++)
|
||||
{
|
||||
theBuff2.SetX(i, theCoeff[it].GetCoeff(i));
|
||||
theBuff2.SetY(i, theCoeff[it].GetCoeff(i));
|
||||
i++;
|
||||
}
|
||||
|
||||
G4double x1 = theCoeff[it-1].GetEnergy();
|
||||
G4double x2 = theCoeff[it].GetEnergy();
|
||||
G4double x = anEnergy;
|
||||
G4double y1, y2, y, mu;
|
||||
|
||||
G4NeutronHPVector theStore1;
|
||||
theStore1.SetInterpolationManager(aManager1);
|
||||
G4NeutronHPVector theStore2;
|
||||
theStore2.SetInterpolationManager(aManager2);
|
||||
G4NeutronHPVector theStore;
|
||||
|
||||
// for fixed mu get p1, p2 and interpolate according to x
|
||||
for(i=0; i<theBuff1.GetVectorLength(); i++)
|
||||
{
|
||||
mu = theBuff1.GetX(i);
|
||||
y1 = theBuff1.GetY(i);
|
||||
y2 = theBuff2.GetY(mu);
|
||||
y = theInt.Interpolate(theManager.GetScheme(it), x, x1,x2,y1,y2);
|
||||
theStore1.SetData(i, mu, y);
|
||||
}
|
||||
for(i=0; i<theBuff2.GetVectorLength(); i++)
|
||||
{
|
||||
mu = theBuff2.GetX(i);
|
||||
y1 = theBuff2.GetY(i);
|
||||
y2 = theBuff1.GetY(mu);
|
||||
y = theInt.Interpolate(theManager.GetScheme(it), x, x1,x2,y1,y2);
|
||||
theStore2.SetData(i, mu, y);
|
||||
}
|
||||
theStore.Merge(&theStore1, &theStore2);
|
||||
cosTh = theStore.Sample();
|
||||
}
|
||||
else
|
||||
{
|
||||
G4Exception("Two neighbouring distributions with different interpolation");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
G4Exception("unknown representation type in Two-body scattering, case 2");
|
||||
}
|
||||
}
|
||||
|
||||
// now get the energy from kinematics and Q-value.
|
||||
|
||||
G4double restEnergy = anEnergy+GetQValue();
|
||||
|
||||
// assumed to be in CMS @@@@@@@@@@@@@@@@@
|
||||
|
||||
G4double residualMass = GetTarget()->GetMass() + GetNeutron()->GetMass()
|
||||
- result->GetMass() - GetQValue();
|
||||
G4double kinE = restEnergy/(1+result->GetMass()/residualMass); // non relativistic @@
|
||||
result->SetKineticEnergy(kinE); // non relativistic @@
|
||||
G4double phi = twopi*G4UniformRand();
|
||||
G4double theta = acos(cosTh);
|
||||
G4double sinth = sin(theta);
|
||||
G4double mtot = result->GetTotalMomentum();
|
||||
G4ThreeVector tempVector(mtot*sinth*cos(phi), mtot*sinth*sin(phi), mtot*cos(theta) );
|
||||
result->SetMomentum(tempVector);
|
||||
|
||||
// some garbage collection
|
||||
|
||||
// return the result
|
||||
return result;
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHPElastic.hh"
|
||||
#include "G4NeutronHPElasticFS.hh"
|
||||
|
||||
G4NeutronHPElastic::G4NeutronHPElastic()
|
||||
{
|
||||
G4NeutronHPElasticFS * theFS = new G4NeutronHPElasticFS;
|
||||
dirName = getenv("NeutronHPCrossSections");
|
||||
G4String tString = "/Elastic/";
|
||||
dirName = dirName + tString;
|
||||
// G4cout <<"G4NeutronHPElastic::G4NeutronHPElastic testit "<<dirName<<endl;
|
||||
numEle = G4Element::GetNumberOfElements();
|
||||
theElastic = new G4NeutronHPChannel[numEle];
|
||||
for (G4int i=0; i<numEle; i++)
|
||||
{
|
||||
theElastic[i].Init((*(G4Element::GetElementTable()))(i), dirName);
|
||||
while(!theElastic[i].Register(theFS));
|
||||
}
|
||||
delete theFS;
|
||||
}
|
||||
|
||||
G4NeutronHPElastic::~G4NeutronHPElastic()
|
||||
{
|
||||
delete [] theElastic;
|
||||
}
|
||||
|
||||
G4VParticleChange * G4NeutronHPElastic::ApplyYourself(const G4Track& aTrack, G4Nucleus& aTargetNucleus)
|
||||
{
|
||||
G4Material * theMaterial = aTrack.GetMaterial();
|
||||
G4int n = theMaterial->GetNumberOfElements();
|
||||
G4int it = n-1;
|
||||
xSec = new G4double(n);
|
||||
G4double sum=0;
|
||||
G4int i, index;
|
||||
for (i=0; i<n; i++)
|
||||
{
|
||||
index = theMaterial->GetElement(i)->GetIndex();
|
||||
xSec[i] = theElastic[index].GetXsec(aTrack.GetKineticEnergy());
|
||||
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);
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
// 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!!!");
|
||||
G4int numberOfElements = G4Element::GetNumberOfElements();
|
||||
theCrossSections = new G4PhysicsTable( numberOfElements );
|
||||
|
||||
// make a PhysicsVector for each element
|
||||
|
||||
static const G4ElementTable *theElementTable = G4Element::GetElementTable();
|
||||
for( G4int i=0; i<numberOfElements; ++i )
|
||||
(*theCrossSections)(i) =
|
||||
G4NeutronHPData::
|
||||
Instance()->MakePhysicsVector((*theElementTable)[i], this);
|
||||
}
|
||||
|
||||
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"<<endl;
|
||||
}
|
||||
|
||||
G4double G4NeutronHPElasticData::GetCrossSection(const G4DynamicParticle* aP, const G4Element*anE)
|
||||
{
|
||||
G4double result;
|
||||
G4bool outOfRange;
|
||||
G4int index = anE->GetIndex();
|
||||
|
||||
result = (*((*theCrossSections)(index))).GetValue(
|
||||
aP->GetKineticEnergy(), outOfRange);
|
||||
return result;
|
||||
}
|
||||
@@ -0,0 +1,253 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHPElasticFS.hh"
|
||||
#include "G4ReactionProduct.hh"
|
||||
#include "G4Nucleus.hh"
|
||||
#include "G4Proton.hh"
|
||||
#include "G4Deuteron.hh"
|
||||
#include "G4Triton.hh"
|
||||
#include "G4Alpha.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4LorentzVector.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4NeutronHPDataUsed.hh"
|
||||
|
||||
void G4NeutronHPElasticFS::Init (G4double A, G4double Z, G4String & dirName, G4String & aFSType)
|
||||
{
|
||||
G4String tString = "/FS/";
|
||||
G4bool dbool;
|
||||
G4NeutronHPDataUsed aFile = theNames.GetName(A, Z, dirName, tString, dbool);
|
||||
G4String filename = aFile.GetName();
|
||||
theBaseA = aFile.GetA();
|
||||
theBaseZ = aFile.GetZ();
|
||||
if(!dbool)
|
||||
{
|
||||
hasAnyData = false;
|
||||
hasFSData = false;
|
||||
hasXsec = false;
|
||||
return;
|
||||
}
|
||||
ifstream theData(filename, ios::in);
|
||||
theData >> repFlag >> targetMass >> frameFlag;
|
||||
if(repFlag==1)
|
||||
{
|
||||
G4int nEnergy;
|
||||
theData >> nEnergy;
|
||||
theCoefficients = new G4NeutronHPLegendreStore(nEnergy);
|
||||
theCoefficients->InitInterpolation(theData);
|
||||
G4double temp, energy;
|
||||
G4int tempdep, nLegendre;
|
||||
G4int i, ii;
|
||||
for (i=0; i<nEnergy; i++)
|
||||
{
|
||||
theData >> temp >> energy >> tempdep >> nLegendre;
|
||||
energy *=eV;
|
||||
theCoefficients->Init(i, energy, nLegendre);
|
||||
theCoefficients->SetTemperature(i, temp);
|
||||
G4double coeff=0;
|
||||
for(ii=0; ii<nLegendre; ii++)
|
||||
{
|
||||
// load legendre coefficients.
|
||||
theData >> coeff;
|
||||
theCoefficients->SetCoeff(i, ii+1, coeff); // @@@HPW@@@
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (repFlag==2)
|
||||
{
|
||||
G4int nEnergy;
|
||||
theData >> nEnergy;
|
||||
theProbArray = new G4NeutronHPPartial(nEnergy, nEnergy);
|
||||
theProbArray->InitInterpolation(theData);
|
||||
G4double temp, energy;
|
||||
G4int tempdep, nPoints;
|
||||
for(G4int i=0; i<nEnergy; i++)
|
||||
{
|
||||
theData >> temp >> energy >> tempdep >> nPoints;
|
||||
energy *= eV;
|
||||
theProbArray->InitInterpolation(i, theData);
|
||||
theProbArray->SetT(i, temp);
|
||||
theProbArray->SetX(i, energy);
|
||||
G4double prob, costh;
|
||||
for(G4int ii=0; ii<nPoints; ii++)
|
||||
{
|
||||
// fill probability arrays.
|
||||
theData >> costh >> prob;
|
||||
theProbArray->SetX(i, ii, costh);
|
||||
theProbArray->SetY(i, ii, prob);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (repFlag==0)
|
||||
{
|
||||
theData >> frameFlag;
|
||||
}
|
||||
else
|
||||
{
|
||||
G4cout << "unusable number for repFlag: repFlag="<<repFlag<<endl;
|
||||
G4Exception("G4NeutronHPElasticFS::Init -- unusable number for repFlag");
|
||||
}
|
||||
}
|
||||
G4ParticleChange * G4NeutronHPElasticFS::ApplyYourself(const G4Track & theTrack)
|
||||
{
|
||||
G4int i, ii, iii;
|
||||
// G4cout << "G4NeutronHPElasticFS::ApplyYourself+"<<endl;
|
||||
theResult.Initialize(theTrack);
|
||||
G4double eKinetic = theTrack.GetKineticEnergy();
|
||||
const G4DynamicParticle *incidentParticle = theTrack.GetDynamicParticle();
|
||||
G4ReactionProduct theNeutron( incidentParticle->GetDefinition() );
|
||||
theNeutron.SetMomentum( incidentParticle->GetMomentum() );
|
||||
theNeutron.SetKineticEnergy( eKinetic );
|
||||
// G4cout << "G4NeutronHPElasticFS::ApplyYourself++"<<eKinetic<<" "<<endl;
|
||||
// G4cout << "CMSVALUES 0 "<<theNeutron.GetTotalMomentum()<<endl;
|
||||
G4double pold = theNeutron.GetTotalMomentum();
|
||||
|
||||
G4ReactionProduct theTarget;
|
||||
G4Nucleus aNucleus;
|
||||
theTarget = aNucleus.GetThermalNucleus( targetMass );
|
||||
// G4cout << "Nucleus-test"<<" "<<targetMass<<" ";
|
||||
// G4cout << theTarget.GetMomentum().x()<<" ";
|
||||
// G4cout << theTarget.GetMomentum().y()<<" ";
|
||||
// G4cout << theTarget.GetMomentum().z()<<endl;
|
||||
|
||||
// neutron and target defined as reaction products.
|
||||
|
||||
// prepare lorentz-transformation to Lab.
|
||||
|
||||
G4ThreeVector the3Neutron = theNeutron.GetMomentum();
|
||||
G4double nEnergy = theNeutron.GetTotalEnergy();
|
||||
G4ThreeVector the3Target = theTarget.GetMomentum();
|
||||
// cout << "@@@" << the3Target<<endl;
|
||||
G4double tEnergy = theTarget.GetTotalEnergy();
|
||||
G4ReactionProduct theCMS;
|
||||
G4double totE = nEnergy+tEnergy;
|
||||
G4ThreeVector the3CMS = the3Target+the3Neutron;
|
||||
theCMS.SetMomentum(the3CMS);
|
||||
G4double cmsMom = sqrt(the3CMS*the3CMS);
|
||||
G4double sqrts = sqrt((totE-cmsMom)*(totE+cmsMom));
|
||||
theCMS.SetMass(sqrts);
|
||||
theCMS.SetTotalEnergy(totE);
|
||||
|
||||
// data come as fcn of n-energy in nuclear rest frame
|
||||
G4ReactionProduct boosted;
|
||||
boosted.Lorentz(theNeutron, theTarget);
|
||||
eKinetic = boosted.GetKineticEnergy(); // get kinetic energy for scattering
|
||||
G4double cosTh = -2;
|
||||
if(repFlag == 1)
|
||||
{
|
||||
cosTh = theCoefficients->SampleElastic(eKinetic);
|
||||
}
|
||||
|
||||
else if (repFlag==2)
|
||||
{
|
||||
cosTh = theProbArray->Sample(eKinetic);
|
||||
}
|
||||
else if (repFlag==0)
|
||||
{
|
||||
cosTh = 2.*G4UniformRand()-1.;
|
||||
}
|
||||
else
|
||||
{
|
||||
G4cout << "unusable number for repFlag: repFlag="<<repFlag<<endl;
|
||||
G4Exception("G4NeutronHPElasticFS::Init -- unusable number for repFlag");
|
||||
}
|
||||
if(cosTh<-1.1) return NULL;
|
||||
G4double phi = twopi*G4UniformRand();
|
||||
G4double theta = acos(cosTh);
|
||||
G4double sinth = sin(theta);
|
||||
if (frameFlag == 1) // final state data given in target rest frame.
|
||||
{
|
||||
// we have the scattering angle, now we need the energy, then do the
|
||||
// boosting.
|
||||
// relativistic elastic scattering energy angular correlation:
|
||||
theNeutron.Lorentz(theNeutron, theTarget);
|
||||
G4double e0 = theNeutron.GetTotalEnergy();
|
||||
G4double p0 = theNeutron.GetTotalMomentum();
|
||||
G4double mN = theNeutron.GetMass();
|
||||
G4double mT = theTarget.GetMass();
|
||||
G4double eE = e0+mT;
|
||||
G4double ap = (mT+eE)*(mT-eE) + (p0+mN)*(p0-mN);
|
||||
G4double a = 4*(eE+p0*cosTh)*(eE-p0*cosTh);
|
||||
G4double b = 4*ap*p0*cosTh;
|
||||
G4double c = (2.*eE*mN-ap)*(2.*eE*mN+ap);
|
||||
G4double en = (-b+sqrt(b*b - 4*a*c) )/(2*a);
|
||||
G4ThreeVector tempVector(en*sinth*cos(phi), en*sinth*sin(phi), en*cos(theta) );
|
||||
theNeutron.SetMomentum(tempVector);
|
||||
theNeutron.SetTotalEnergy(sqrt(en*en+theNeutron.GetMass()*theNeutron.GetMass()));
|
||||
// first to lab
|
||||
theNeutron.Lorentz(theNeutron, -1.*theTarget);
|
||||
// now to CMS
|
||||
theNeutron.Lorentz(theNeutron, theCMS);
|
||||
theTarget.SetMomentum(-theNeutron.GetMomentum());
|
||||
theTarget.SetTotalEnergy(theNeutron.GetTotalEnergy());
|
||||
// and back to lab
|
||||
theNeutron.Lorentz(theNeutron, -1.*theCMS);
|
||||
theTarget.Lorentz(theTarget, -1.*theCMS);
|
||||
}
|
||||
else if (frameFlag == 2) // CMS
|
||||
{
|
||||
theNeutron.Lorentz(theNeutron, theCMS);
|
||||
theTarget.Lorentz(theTarget, theCMS);
|
||||
G4double en = theNeutron.GetTotalMomentum();
|
||||
G4ThreeVector tempVector(en*sinth*cos(phi), en*sinth*sin(phi), en*cos(theta) );
|
||||
theNeutron.SetMomentum(tempVector);
|
||||
theTarget.SetMomentum(-tempVector);
|
||||
G4double tP = theTarget.GetTotalMomentum();
|
||||
G4double tM = theTarget.GetMass();
|
||||
theTarget.SetTotalEnergy(sqrt((tP+tM)*(tP+tM)-2.*tP*tM));
|
||||
theNeutron.Lorentz(theNeutron, -1.*theCMS);
|
||||
theTarget.Lorentz(theTarget, -1.*theCMS);
|
||||
}
|
||||
else
|
||||
{
|
||||
G4cout <<"Value of frameFlag (1=LAB, 2=CMS): "<<frameFlag;
|
||||
G4Exception("G4NeutronHPElasticFS::ApplyYourSelf frameflag incorrect");
|
||||
}
|
||||
// now all in Lab
|
||||
// nun den recoil generieren...und energy change, momentum change angeben.
|
||||
theResult.SetEnergyChange(theNeutron.GetKineticEnergy());
|
||||
theResult.SetMomentumChange(theNeutron.GetMomentum().unit());
|
||||
G4DynamicParticle* theRecoil = new G4DynamicParticle;
|
||||
if(targetMass<4.5)
|
||||
{
|
||||
G4bool He3flag = false;
|
||||
if(targetMass<1)
|
||||
{
|
||||
// proton
|
||||
theRecoil->SetDefinition(G4Proton::Proton());
|
||||
}
|
||||
else if(targetMass<2 )
|
||||
{
|
||||
// deuteron
|
||||
theRecoil->SetDefinition(G4Deuteron::Deuteron());
|
||||
}
|
||||
else if(targetMass<2.999 )
|
||||
{
|
||||
// 3He
|
||||
theRecoil->SetDefinition(G4He3::He3());
|
||||
}
|
||||
else if(targetMass<3 )
|
||||
{
|
||||
// Triton
|
||||
theRecoil->SetDefinition(G4Triton::Triton());
|
||||
}
|
||||
else
|
||||
{
|
||||
// alpha
|
||||
theRecoil->SetDefinition(G4Alpha::Alpha());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
theRecoil->SetDefinition(G4ParticleTable::GetParticleTable()->FindIon(theBaseZ, theBaseA, 0, theBaseZ));
|
||||
}
|
||||
theRecoil->SetMomentum(theTarget.GetMomentum());
|
||||
theResult.SetNumberOfSecondaries(1);
|
||||
theResult.AddSecondary(theRecoil);
|
||||
// G4cout << "G4NeutronHPElasticFS::ApplyYourself 10+"<<endl;
|
||||
// postpone the tracking of the primary neutron
|
||||
theResult.SetStatusChange(fSuspend);
|
||||
return &theResult;
|
||||
}
|
||||
@@ -0,0 +1,196 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHPElementData.hh"
|
||||
|
||||
G4NeutronHPElementData::G4NeutronHPElementData()
|
||||
{
|
||||
theFissionData = new G4NeutronHPVector;
|
||||
theCaptureData = new G4NeutronHPVector;
|
||||
theElasticData = new G4NeutronHPVector;
|
||||
theInelasticData = new G4NeutronHPVector;
|
||||
theIsotopeWiseData = NULL;
|
||||
}
|
||||
|
||||
G4NeutronHPElementData::~G4NeutronHPElementData()
|
||||
{
|
||||
if(theFissionData!=NULL) delete theFissionData;
|
||||
if(theCaptureData!=NULL) delete theCaptureData;
|
||||
if(theElasticData!=NULL) delete theElasticData;
|
||||
if(theInelasticData!=NULL) delete theInelasticData;
|
||||
if(theIsotopeWiseData!=NULL) delete [] theIsotopeWiseData;
|
||||
}
|
||||
|
||||
void G4NeutronHPElementData::Init(G4Element * theElement)
|
||||
{
|
||||
G4int count = theElement->GetNumberOfIsotopes();
|
||||
if(count == 0) count +=
|
||||
theStableOnes.GetNumberOfIsotopes(theElement->GetZ());
|
||||
theIsotopeWiseData = new G4NeutronHPIsoData[count];
|
||||
// filename = ein data-set je isotope.
|
||||
count = 0;
|
||||
G4int nIso = theElement->GetNumberOfIsotopes();
|
||||
G4int Z = theElement->GetZ();
|
||||
G4int i1;
|
||||
if(nIso!=0)
|
||||
{
|
||||
for (i1=0; i1<nIso; i1++)
|
||||
{
|
||||
// G4cout <<" Init: normal case"<<endl;
|
||||
G4int A = theElement->GetIsotope(i1)->GetN();
|
||||
G4double frac = theElement->GetRelativeAbundanceVector()[i1]/perCent;
|
||||
UpdateData(A, Z, count++, frac);
|
||||
}
|
||||
}else{
|
||||
// G4cout <<" Init: theStableOnes case: Z="<<Z<<endl;
|
||||
G4int first = theStableOnes.GetFirstIsotope(Z);
|
||||
// G4cout <<"first="<<first<<" "<<theStableOnes.GetNumberOfIsotopes(theElement->GetZ())<<endl;
|
||||
for(G4int i1=0;
|
||||
i1<theStableOnes.GetNumberOfIsotopes(theElement->GetZ());
|
||||
i1++)
|
||||
{
|
||||
// G4cout <<" Init: theStableOnes in the loop"<<endl;
|
||||
G4int A = theStableOnes.GetIsotopeNucleonCount(first+i1);
|
||||
G4double frac = theStableOnes.GetAbundance(first+i1);
|
||||
// G4cout <<" Init: theStableOnes in the loop: "<<A<<endl;
|
||||
UpdateData(A, Z, count++, frac);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void G4NeutronHPElementData::UpdateData(G4int A, G4int Z, G4int index, G4double abundance)
|
||||
{
|
||||
//Reads in the Data, using G4NeutronHPIsoData[], and its Init
|
||||
// G4cout << "entered: ElementWiseData::UpdateData"<<endl;
|
||||
theIsotopeWiseData[index].Init(A, Z, abundance);
|
||||
// G4cout << "ElementWiseData::UpdateData Init finished"<<endl;
|
||||
|
||||
theBuffer = theIsotopeWiseData[index].MakeElasticData();
|
||||
// G4cout << "ElementWiseData::UpdateData MakeElasticData finished: "
|
||||
// <<theBuffer->GetVectorLength()<<endl;
|
||||
Harmonise(theElasticData, theBuffer);
|
||||
// G4cout << "ElementWiseData::UpdateData Harmonise finished: "
|
||||
// <<theElasticData->GetVectorLength()<<endl;
|
||||
delete theBuffer;
|
||||
|
||||
theBuffer = theIsotopeWiseData[index].MakeInelasticData();
|
||||
// G4cout << "ElementWiseData::UpdateData MakeInelasticData finished: "
|
||||
// <<theBuffer->GetVectorLength()<<endl;
|
||||
Harmonise(theInelasticData, theBuffer);
|
||||
// G4cout << "ElementWiseData::UpdateData Harmonise finished: "
|
||||
// <<theInelasticData->GetVectorLength()<<endl;
|
||||
delete theBuffer;
|
||||
|
||||
theBuffer = theIsotopeWiseData[index].MakeCaptureData();
|
||||
// G4cout << "ElementWiseData::UpdateData MakeCaptureData finished: "
|
||||
// <<theBuffer->GetVectorLength()<<endl;
|
||||
Harmonise(theCaptureData, theBuffer);
|
||||
// G4cout << "ElementWiseData::UpdateData Harmonise finished: "
|
||||
// <<theCaptureData->GetVectorLength()<<endl;
|
||||
delete theBuffer;
|
||||
|
||||
theBuffer = theIsotopeWiseData[index].MakeFissionData();
|
||||
// G4cout << "ElementWiseData::UpdateData MakeFissionData finished: "
|
||||
// <<theBuffer->GetVectorLength()<<endl;
|
||||
Harmonise(theFissionData, theBuffer);
|
||||
// G4cout << "ElementWiseData::UpdateData Harmonise finished: "
|
||||
// <<theFissionData->GetVectorLength()<<endl;
|
||||
delete theBuffer;
|
||||
|
||||
// G4cout << "ElementWiseData::UpdateData finished"<endl;
|
||||
}
|
||||
|
||||
void G4NeutronHPElementData::Harmonise(G4NeutronHPVector *& theStore, G4NeutronHPVector * theNew)
|
||||
{
|
||||
if(theNew == NULL) return;
|
||||
G4int s = 0, n=0, i=0, m=0;
|
||||
G4NeutronHPVector * theMerge = new G4NeutronHPVector;
|
||||
G4bool flag;
|
||||
// G4cout << "Harmonise 1: "<<theStore->GetEnergy(s)<<" "<<theNew->GetEnergy(0)<<endl;
|
||||
while ( theStore->GetEnergy(s)<theNew->GetEnergy(0)&&s<theStore->GetVectorLength() )
|
||||
{
|
||||
theMerge->SetData(m++, theStore->GetEnergy(s), theStore->GetXsec(s));
|
||||
s++;
|
||||
}
|
||||
G4NeutronHPVector *active = theStore;
|
||||
G4NeutronHPVector * passive = theNew;
|
||||
G4NeutronHPVector * tmp;
|
||||
G4int a = s, p = n, t;
|
||||
// G4cout << "Harmonise 2: "<<active->GetVectorLength()<<" "<<passive->GetVectorLength()<<endl;
|
||||
while (a<active->GetVectorLength()&&p<passive->GetVectorLength())
|
||||
{
|
||||
if(active->GetEnergy(a) <= passive->GetEnergy(p))
|
||||
{
|
||||
// G4cout << "Harmoniseing 1: "<<a<<" "<<p<<" "<<active->GetEnergy(a)<<" "<<passive->GetEnergy(p)<<endl;
|
||||
theMerge->SetData(m, active->GetEnergy(a), active->GetXsec(a));
|
||||
// addiere passiv. interpoliert auf demn punkt theMerge.GetLowEdgeEnergy(m)
|
||||
// G4cout << "Harmoniseing 2: "<<a<<" "<<p<<" "<<active->GetEnergy(a)<<" "<<passive->GetEnergy(p)<<endl;
|
||||
G4double x = theMerge->GetEnergy(m);
|
||||
G4double x1 = passive->GetEnergy(p);
|
||||
G4double x2 = passive->GetEnergy(p+1);
|
||||
G4double y1 = passive->GetXsec(x1);
|
||||
G4double y2 = passive->GetXsec(x2);
|
||||
G4double y = passive->GetXsec(x);
|
||||
// G4cout << "Harmoniseing 3: "<<a<<" "<<p<<" "<<active->GetEnergy(a)<<" "<<passive->GetEnergy(p)<<endl;
|
||||
theMerge->SetData(m, x, theMerge->GetXsec(m)+y);
|
||||
// G4cout << "Harmoniseing 4: "<<a<<" "<<p<<" "<<active->GetEnergy(a)<<" "<<passive->GetEnergy(p)<<endl;
|
||||
m++;
|
||||
a++;
|
||||
} else {
|
||||
// G4cout << "swapping in Harmonise"<<endl;
|
||||
tmp = active; t=a;
|
||||
active = passive; a=p;
|
||||
passive = tmp; p=t;
|
||||
}
|
||||
}
|
||||
// G4cout << "Harmonise 3: "<< a <<" "<<active->GetVectorLength()<<" "<<m<<endl;
|
||||
while (a!=active->GetVectorLength())
|
||||
{
|
||||
theMerge->SetData(m++, active->GetEnergy(a), active->GetXsec(a));
|
||||
a++;
|
||||
}
|
||||
// G4cout << "Harmonise 4: "<< p <<" "<<passive->GetVectorLength()<<" "<<m<<endl;
|
||||
while (p!=passive->GetVectorLength())
|
||||
{
|
||||
theMerge->SetData(m++, passive->GetEnergy(p), passive->GetXsec(p));
|
||||
p++;
|
||||
}
|
||||
// G4cout <<"Harmonise 5: "<< theMerge->GetVectorLength() << " " << m << endl;
|
||||
delete theStore;
|
||||
theStore = theMerge;
|
||||
// G4cout <<"Harmonise 6: "<< theStore->GetVectorLength() << " " << m << endl;
|
||||
}
|
||||
|
||||
G4NeutronHPVector * G4NeutronHPElementData::MakePhysicsVector(G4Element * theElement,
|
||||
G4ParticleDefinition * theP,
|
||||
G4NeutronHPFissionData* theSet)
|
||||
{
|
||||
if(theP != G4Neutron::Neutron()) G4Exception();
|
||||
Init ( theElement );
|
||||
return GetData(theSet);
|
||||
}
|
||||
G4NeutronHPVector * G4NeutronHPElementData::MakePhysicsVector(G4Element * theElement,
|
||||
G4ParticleDefinition * theP,
|
||||
G4NeutronHPCaptureData * theSet)
|
||||
{
|
||||
if(theP != G4Neutron::Neutron()) G4Exception();
|
||||
Init ( theElement );
|
||||
return GetData(theSet);
|
||||
}
|
||||
G4NeutronHPVector * G4NeutronHPElementData::MakePhysicsVector(G4Element * theElement,
|
||||
G4ParticleDefinition * theP,
|
||||
G4NeutronHPElasticData * theSet)
|
||||
{
|
||||
if(theP != G4Neutron::Neutron()) G4Exception();
|
||||
Init ( theElement );
|
||||
return GetData(theSet);
|
||||
}
|
||||
G4NeutronHPVector * G4NeutronHPElementData::MakePhysicsVector(G4Element * theElement,
|
||||
G4ParticleDefinition * theP,
|
||||
G4NeutronHPInelasticData * theSet)
|
||||
{
|
||||
if(theP != G4Neutron::Neutron()) G4Exception();
|
||||
Init ( theElement );
|
||||
return GetData(theSet);
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHPEnAngCorrelation.hh"
|
||||
|
||||
G4ReactionProduct * G4NeutronHPEnAngCorrelation::SampleOne(G4double anEnergy)
|
||||
{
|
||||
G4ReactionProduct * result = new G4ReactionProduct;
|
||||
|
||||
// do we have an appropriate distribution
|
||||
if(nProducts!=1) G4Exception("More than one product in SampleOne");
|
||||
|
||||
// get the result
|
||||
G4ReactionProductVector * temp=NULL;
|
||||
G4int i=0;
|
||||
while(temp == NULL) temp = theProducts[i++].Sample(anEnergy);
|
||||
|
||||
// is the multiplicity correct
|
||||
if(temp->length()!=1) G4Exception("SampleOne: Yield not correct");
|
||||
|
||||
// fill result
|
||||
result = temp->at(0);
|
||||
|
||||
// some garbage collection
|
||||
delete temp;
|
||||
|
||||
// return result
|
||||
return result;
|
||||
}
|
||||
|
||||
G4ReactionProductVector * G4NeutronHPEnAngCorrelation::Sample(G4double anEnergy)
|
||||
{
|
||||
G4ReactionProductVector * result = new G4ReactionProductVector;
|
||||
G4int i;
|
||||
G4ReactionProductVector * it;
|
||||
G4ReactionProduct theCMS;
|
||||
if(frameFlag==2)
|
||||
{
|
||||
// simplify and double check @
|
||||
G4ThreeVector the3Neutron = theNeutron.GetMomentum();
|
||||
G4double nEnergy = theNeutron.GetTotalEnergy();
|
||||
G4ThreeVector the3Target = theTarget.GetMomentum();
|
||||
G4double tEnergy = theTarget.GetTotalEnergy();
|
||||
G4double totE = nEnergy+tEnergy;
|
||||
G4ThreeVector the3CMS = the3Target+the3Neutron;
|
||||
theCMS.SetMomentum(the3CMS);
|
||||
G4double cmsMom = sqrt(the3CMS*the3CMS);
|
||||
G4double sqrts = sqrt((totE-cmsMom)*(totE+cmsMom));
|
||||
theCMS.SetMass(sqrts);
|
||||
theCMS.SetTotalEnergy(totE);
|
||||
G4ReactionProduct aNeutron;
|
||||
aNeutron.Lorentz(theNeutron, theCMS);
|
||||
anEnergy = aNeutron.GetKineticEnergy();
|
||||
}
|
||||
theTotalMeanEnergy=0;
|
||||
for(i=0; i<nProducts; i++)
|
||||
{
|
||||
it = theProducts[i].Sample(anEnergy);
|
||||
G4double aMeanEnergy = theProducts[i].MeanEnergyOfThisInteraction();
|
||||
if(aMeanEnergy>0)
|
||||
{
|
||||
theTotalMeanEnergy += aMeanEnergy;
|
||||
}
|
||||
else
|
||||
{
|
||||
theTotalMeanEnergy = anEnergy/nProducts+theProducts[i].GetQValue();
|
||||
}
|
||||
if(it!=NULL)
|
||||
{
|
||||
for(G4int ii=0; ii<it->length(); ii++)
|
||||
{
|
||||
if(frameFlag==1) // target rest
|
||||
{
|
||||
it->at(ii)->Lorentz(*(it->at(ii)), -1.*theTarget);
|
||||
}
|
||||
else if(frameFlag==2) // CMS
|
||||
{
|
||||
#ifdef G4_NHP_DEBUG
|
||||
cout <<"G4NeutronHPEnAngCorrelation: "<<
|
||||
it->at(ii)->GetTotalEnergy()<<" "<<
|
||||
it->at(ii)->GetMomentum()<<endl;
|
||||
#endif
|
||||
it->at(ii)->Lorentz(*(it->at(ii)), -1.*theCMS);
|
||||
}
|
||||
else
|
||||
{
|
||||
G4Exception("G4NeutronHPEnAngCorrelation::Sample: The frame of the finalstate is not specified");
|
||||
}
|
||||
result->insert(it->at(ii));
|
||||
}
|
||||
delete it;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHPFCFissionFS.hh"
|
||||
|
||||
void G4NeutronHPFCFissionFS::Init (G4double A, G4double Z, G4String & dirName, G4String & aFSType)
|
||||
{
|
||||
G4String aString = "/FC/";
|
||||
G4NeutronHPFissionBaseFS::Init(A, Z, dirName, aString);
|
||||
}
|
||||
|
||||
G4DynamicParticleVector * G4NeutronHPFCFissionFS::ApplyYourself(G4int nNeutrons)
|
||||
{
|
||||
G4DynamicParticleVector * aResult;
|
||||
// G4cout <<"G4NeutronHPFCFissionFS::ApplyYourself +"<<endl;
|
||||
aResult = G4NeutronHPFissionBaseFS::ApplyYourself(nNeutrons);
|
||||
return aResult;
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHPFSFissionFS.hh"
|
||||
#include "G4ReactionProduct.hh"
|
||||
#include "G4Nucleus.hh"
|
||||
#include "G4Proton.hh"
|
||||
#include "G4Deuteron.hh"
|
||||
#include "G4Triton.hh"
|
||||
#include "G4Alpha.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4LorentzVector.hh"
|
||||
#include "G4NeutronHPDataUsed.hh"
|
||||
|
||||
void G4NeutronHPFSFissionFS::Init (G4double A, G4double Z, G4String & dirName, G4String & aFSType)
|
||||
{
|
||||
G4String tString = "/FS/";
|
||||
G4bool dbool;
|
||||
G4NeutronHPDataUsed aFile = theNames.GetName(A, Z, dirName, tString, dbool);
|
||||
G4String filename = aFile.GetName();
|
||||
if(!dbool)
|
||||
{
|
||||
hasAnyData = false;
|
||||
hasFSData = false;
|
||||
hasXsec = false;
|
||||
return;
|
||||
}
|
||||
ifstream theData(filename, ios::in);
|
||||
// here it comes
|
||||
G4int infoType, dataType;
|
||||
hasFSData = false;
|
||||
while (theData >> infoType)
|
||||
{
|
||||
hasFSData = true;
|
||||
theData >> dataType;
|
||||
switch(infoType)
|
||||
{
|
||||
case 1:
|
||||
if(dataType==4) theNeutronAngularDis.Init(theData);
|
||||
if(dataType==5) thePromptNeutronEnDis.Init(theData);
|
||||
if(dataType==12) theFinalStatePhotons.InitMean(theData);
|
||||
if(dataType==14) theFinalStatePhotons.InitAngular(theData);
|
||||
if(dataType==15) theFinalStatePhotons.InitEnergies(theData);
|
||||
break;
|
||||
case 2:
|
||||
if(dataType==1) theFinalStateNeutrons.InitMean(theData);
|
||||
break;
|
||||
case 3:
|
||||
if(dataType==1) theFinalStateNeutrons.InitDelayed(theData);
|
||||
if(dataType==5) theDelayedNeutronEnDis.Init(theData);
|
||||
break;
|
||||
case 4:
|
||||
if(dataType==1) theFinalStateNeutrons.InitPrompt(theData);
|
||||
break;
|
||||
case 5:
|
||||
if(dataType==1) theEnergyRelease.Init(theData);
|
||||
break;
|
||||
default:
|
||||
G4cout << "G4NeutronHPFSFissionFS::Init: unknown data type"<<dataType<<endl;
|
||||
G4Exception("G4NeutronHPFSFissionFS::Init: unknown data type");
|
||||
break;
|
||||
}
|
||||
}
|
||||
targetMass = theFinalStateNeutrons.GetTargetMass();
|
||||
}
|
||||
|
||||
|
||||
G4DynamicParticleVector * G4NeutronHPFSFissionFS::ApplyYourself(G4int nPrompt,
|
||||
G4int nDelayed, G4double * theDecayConst)
|
||||
{
|
||||
G4int i;
|
||||
G4DynamicParticleVector * aResult = new G4DynamicParticleVector;
|
||||
G4ReactionProduct boosted;
|
||||
boosted.Lorentz(theNeutron, theTarget);
|
||||
G4double eKinetic = boosted.GetKineticEnergy();
|
||||
|
||||
// Build neutrons
|
||||
G4ReactionProduct * theNeutrons = new G4ReactionProduct[nPrompt+nDelayed];
|
||||
for(i=0; i<nPrompt+nDelayed; i++)
|
||||
{
|
||||
theNeutrons[i].SetDefinition(G4Neutron::Neutron());
|
||||
}
|
||||
|
||||
// sample energies
|
||||
G4int it, dummy;
|
||||
G4double tempE;
|
||||
for(i=0; i<nPrompt; i++)
|
||||
{
|
||||
tempE = thePromptNeutronEnDis.Sample(eKinetic, dummy); // energy distribution (file5) always in lab
|
||||
theNeutrons[i].SetKineticEnergy(tempE);
|
||||
}
|
||||
for(i=nPrompt; i<nPrompt+nDelayed; i++)
|
||||
{
|
||||
theNeutrons[i].SetKineticEnergy(theDelayedNeutronEnDis.Sample(eKinetic, it)); // dito
|
||||
if(it==0) theNeutrons[i].SetKineticEnergy(thePromptNeutronEnDis.Sample(eKinetic, dummy));
|
||||
theDecayConst[i-nPrompt] = theFinalStateNeutrons.GetDecayConstant(it); // this is returned
|
||||
}
|
||||
|
||||
// sample neutron angular distribution
|
||||
for(i=0; i<nPrompt+nDelayed; i++)
|
||||
{
|
||||
theNeutronAngularDis.SampleAndUpdate(theNeutrons[i]); // angular comes back in lab automatically
|
||||
}
|
||||
|
||||
// already in lab. Add neutrons to dynamic particle vector
|
||||
for(i=0; i<nPrompt+nDelayed; i++)
|
||||
{
|
||||
G4DynamicParticle * it = new G4DynamicParticle;
|
||||
it->SetDefinition(theNeutrons[i].GetDefinition());
|
||||
it->SetMomentum(theNeutrons[i].GetMomentum());
|
||||
aResult->insert(it);
|
||||
}
|
||||
delete [] theNeutrons;
|
||||
// return the result
|
||||
return aResult;
|
||||
}
|
||||
|
||||
void G4NeutronHPFSFissionFS::SampleNeutronMult(G4int&all, G4int&Prompt, G4int&delayed, G4double eKinetic, G4int off)
|
||||
{
|
||||
G4double promptNeutronMulti = 0;
|
||||
promptNeutronMulti = theFinalStateNeutrons.GetPrompt(eKinetic);
|
||||
G4double delayedNeutronMulti = 0;
|
||||
delayedNeutronMulti = theFinalStateNeutrons.GetDelayed(eKinetic);
|
||||
|
||||
if(delayedNeutronMulti==0&&promptNeutronMulti==0)
|
||||
{
|
||||
Prompt = 0;
|
||||
delayed = 0;
|
||||
G4double totalNeutronMulti = theFinalStateNeutrons.GetMean(eKinetic);
|
||||
all = RandPoisson::shoot(totalNeutronMulti-off);
|
||||
all += off;
|
||||
}
|
||||
else
|
||||
{
|
||||
Prompt = RandPoisson::shoot(promptNeutronMulti-off);
|
||||
Prompt += off;
|
||||
delayed = RandPoisson::shoot(delayedNeutronMulti);
|
||||
all = Prompt+delayed;
|
||||
}
|
||||
}
|
||||
|
||||
G4DynamicParticleVector * G4NeutronHPFSFissionFS::GetPhotons()
|
||||
{
|
||||
// sample photons
|
||||
G4ReactionProductVector * temp;
|
||||
G4ReactionProduct boosted;
|
||||
// the photon distributions are in the Nucleus rest frame.
|
||||
boosted.Lorentz(theNeutron, theTarget);
|
||||
G4double anEnergy = boosted.GetKineticEnergy();
|
||||
temp = theFinalStatePhotons.GetPhotons(anEnergy);
|
||||
if(temp == NULL) return NULL;
|
||||
|
||||
// lorentz transform, and add photons to final state
|
||||
G4int i;
|
||||
G4DynamicParticleVector * result = new G4DynamicParticleVector;
|
||||
for(i=0; i<temp->length(); i++)
|
||||
{
|
||||
// back to lab
|
||||
temp->at(i)->Lorentz(*temp->at(i), -1.*theTarget);
|
||||
G4DynamicParticle * theOne = new G4DynamicParticle;
|
||||
theOne->SetDefinition(temp->at(i)->GetDefinition());
|
||||
theOne->SetMomentum(temp->at(i)->GetMomentum());
|
||||
result->insert(theOne);
|
||||
delete temp->at(i);
|
||||
}
|
||||
delete temp;
|
||||
return result;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,94 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHPField.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
|
||||
G4NeutronHPField::G4NeutronHPField()
|
||||
{
|
||||
theData = new G4NeutronHPFieldPoint[100];
|
||||
nPoints=100;
|
||||
nEntries=0;
|
||||
theData->SetData(0,0,0);
|
||||
}
|
||||
|
||||
G4NeutronHPField::~G4NeutronHPField(){ delete [] theData;}
|
||||
|
||||
G4double G4NeutronHPField::GetY(G4double e, G4int j)
|
||||
{
|
||||
G4int found = 0;
|
||||
G4int low = 0;
|
||||
G4int high = 0;
|
||||
G4int i;
|
||||
for (i=1; i<nEntries/10; i++)
|
||||
{
|
||||
if(theData[10*i].GetX()>e) break;
|
||||
}
|
||||
if(i==(nEntries/10))
|
||||
{
|
||||
i=10*i;
|
||||
while (i<nEntries)
|
||||
{
|
||||
if(theData[i++].GetX()>e) break;
|
||||
}
|
||||
if (i==nEntries)
|
||||
{
|
||||
low = nEntries-1;
|
||||
high = nEntries-2;
|
||||
}else{
|
||||
low = i-1;
|
||||
high = i;
|
||||
}
|
||||
}else{
|
||||
for (G4int j=0; j<10; j++)
|
||||
{
|
||||
if(theData[i].GetX()<e) break;
|
||||
i--;
|
||||
}
|
||||
low = i;
|
||||
high = i+1;
|
||||
}
|
||||
G4double x1, x2, y1, y2, x, y;
|
||||
x = e;
|
||||
x1 = theData[low] .GetX();
|
||||
x2 = theData[high].GetX();
|
||||
y1 = theData[low] .GetY(j);
|
||||
y2 = theData[high].GetY(j);
|
||||
y = x*(y2-y1)/(x2-x1);
|
||||
return y += y2-x2*(y2-y1)/(x2-x1);
|
||||
}
|
||||
|
||||
void G4NeutronHPField::Dump()
|
||||
{
|
||||
G4cout << nEntries<<endl;
|
||||
for(G4int i=0; i<nEntries; i++)
|
||||
{
|
||||
G4cout << theData[i].GetX()<<" ";
|
||||
for(G4int j=0; j<theData[i].GetDepth(); j++)
|
||||
{
|
||||
G4cout << theData[i].GetY(j)<<" ";
|
||||
}
|
||||
G4cout << endl;
|
||||
}
|
||||
}
|
||||
|
||||
void G4NeutronHPField::Check(G4int i)
|
||||
{
|
||||
if(i>nEntries) G4Exception("Skipped some index numbers in G4NeutronHPField");
|
||||
if(i==nPoints)
|
||||
{
|
||||
nPoints += 50;
|
||||
G4NeutronHPFieldPoint * buff = new G4NeutronHPFieldPoint[nPoints];
|
||||
// G4cout << "copying 1"<<endl;
|
||||
for (G4int j=0; j<nEntries; j++)
|
||||
{
|
||||
buff[j] = theData[j];
|
||||
}
|
||||
// G4cout << "copying 2"<<endl;
|
||||
delete [] theData;
|
||||
theData = buff;
|
||||
}
|
||||
if(i==nEntries) nEntries=i+1;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
|
||||
#include "G4NeutronHPFieldPoint.hh"
|
||||
|
||||
G4NeutronHPFieldPoint::G4NeutronHPFieldPoint(G4int n)
|
||||
{
|
||||
nP = n;
|
||||
X = 0;
|
||||
Y = new G4double[nP];
|
||||
for (G4int i=0; i<nP; i++) Y[i]=0.;
|
||||
}
|
||||
|
||||
void G4NeutronHPFieldPoint::operator= (const G4NeutronHPFieldPoint & aSet)
|
||||
{
|
||||
if(&aSet!=this)
|
||||
{
|
||||
X = aSet.GetX();
|
||||
if(Y!=NULL) delete [] Y;
|
||||
Y = new G4double[aSet.GetDepth()];
|
||||
for(G4int i=0; i<aSet.GetDepth(); i++) Y[i] = aSet.GetY(i);
|
||||
}
|
||||
}
|
||||
|
||||
G4NeutronHPFieldPoint::~G4NeutronHPFieldPoint()
|
||||
{
|
||||
if(Y!=NULL) delete [] Y;
|
||||
}
|
||||
|
||||
void G4NeutronHPFieldPoint::InitY(G4int n)
|
||||
{
|
||||
nP = n;
|
||||
X=0;
|
||||
Y = new G4double[nP];
|
||||
for (G4int i=0; i<nP; i++) Y[i]=0.;
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHPFission.hh"
|
||||
|
||||
G4NeutronHPFission::G4NeutronHPFission()
|
||||
{
|
||||
SetMinEnergy( 0.0 );
|
||||
SetMaxEnergy( 20.*MeV );
|
||||
dirName = getenv("NeutronHPCrossSections");
|
||||
G4String tString = "/Fission/";
|
||||
dirName = dirName + tString;
|
||||
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);
|
||||
theFission[i].Register(&theFS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
G4NeutronHPFission::~G4NeutronHPFission()
|
||||
{
|
||||
delete [] theFission;
|
||||
}
|
||||
|
||||
G4VParticleChange * G4NeutronHPFission::ApplyYourself(const G4Track& aTrack, G4Nucleus& aTargetNucleus)
|
||||
{
|
||||
G4Material * theMaterial = aTrack.GetMaterial();
|
||||
G4int n = theMaterial->GetNumberOfElements();
|
||||
xSec = new G4double(n);
|
||||
G4double sum=0;
|
||||
G4int i, it, index;
|
||||
for (i=0; i<n; i++)
|
||||
{
|
||||
index = theMaterial->GetElement(i)->GetIndex();
|
||||
xSec[i] = theFission[index].GetXsec(aTrack.GetKineticEnergy());
|
||||
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;
|
||||
return theFission[index].ApplyYourself(aTrack);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHPFissionBaseFS.hh"
|
||||
#include "G4ReactionProduct.hh"
|
||||
#include "G4Nucleus.hh"
|
||||
#include "G4Proton.hh"
|
||||
#include "G4Deuteron.hh"
|
||||
#include "G4Triton.hh"
|
||||
#include "G4Alpha.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4LorentzVector.hh"
|
||||
#include "G4NeutronHPDataUsed.hh"
|
||||
|
||||
void G4NeutronHPFissionBaseFS::Init (G4double A, G4double Z, G4String & dirName, G4String & bit)
|
||||
{
|
||||
G4String tString = dirName;
|
||||
G4bool dbool;
|
||||
G4NeutronHPDataUsed aFile = theNames.GetName(A, Z, tString, bit, dbool);
|
||||
G4String filename = aFile.GetName();
|
||||
theBaseA = aFile.GetA();
|
||||
theBaseZ = aFile.GetZ();
|
||||
if(!dbool)
|
||||
{
|
||||
hasAnyData = false;
|
||||
hasFSData = false;
|
||||
hasXsec = false;
|
||||
return; // no data for exactly this isotope.
|
||||
}
|
||||
ifstream theData(filename, ios::in);
|
||||
G4int dummy;
|
||||
G4double dumm;
|
||||
if(!(theData))
|
||||
{
|
||||
hasFSData = false;
|
||||
hasXsec = false;
|
||||
hasAnyData = false;
|
||||
return; // no data for this FS for this isotope
|
||||
}
|
||||
theData >> dummy>>dummy;
|
||||
G4int total;
|
||||
theData >> total;
|
||||
theXsection->Init(theData, total, eV);
|
||||
if (!(theData >> dummy))
|
||||
{
|
||||
hasFSData = false;
|
||||
return;
|
||||
}
|
||||
theData >> dummy;
|
||||
|
||||
theAngularDistribution.Init(theData);
|
||||
|
||||
theData >> dummy >> dummy;
|
||||
|
||||
theEnergyDistribution.Init(theData);
|
||||
|
||||
}
|
||||
|
||||
G4DynamicParticleVector * G4NeutronHPFissionBaseFS::ApplyYourself(G4int nPrompt)
|
||||
{
|
||||
// if therere were no data for this isotope, break out.
|
||||
if(!HasFSData()) return NULL;
|
||||
|
||||
G4int i;
|
||||
G4DynamicParticleVector * aResult = new G4DynamicParticleVector;
|
||||
G4ReactionProduct boosted;
|
||||
boosted.Lorentz(theNeutron, theTarget);
|
||||
G4double eKinetic = boosted.GetKineticEnergy();
|
||||
|
||||
// Build neutrons
|
||||
G4ReactionProduct * theNeutrons = new G4ReactionProduct[nPrompt];
|
||||
for(i=0; i<nPrompt; i++)
|
||||
{
|
||||
theNeutrons[i].SetDefinition(G4Neutron::Neutron());
|
||||
}
|
||||
|
||||
// sample energies
|
||||
G4int dummy;
|
||||
for(i=0; i<nPrompt; i++)
|
||||
{
|
||||
// always in the lab system (if file-5)
|
||||
theNeutrons[i].SetKineticEnergy(theEnergyDistribution.Sample(eKinetic, dummy));
|
||||
}
|
||||
|
||||
// sample neutron angular distribution
|
||||
for(i=0; i<nPrompt; i++)
|
||||
{
|
||||
theAngularDistribution.SampleAndUpdate(theNeutrons[i]);
|
||||
}
|
||||
|
||||
// already in lab. Add neutrons to dynamic particle vector
|
||||
for(i=0; i<nPrompt; i++)
|
||||
{
|
||||
G4DynamicParticle * it = new G4DynamicParticle;
|
||||
it->SetDefinition(theNeutrons[i].GetDefinition());
|
||||
it->SetMomentum(theNeutrons[i].GetMomentum());
|
||||
aResult->insert(it);
|
||||
}
|
||||
delete [] theNeutrons;
|
||||
|
||||
// return the result
|
||||
return aResult;
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
// 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!!!");
|
||||
G4int numberOfElements = G4Element::GetNumberOfElements();
|
||||
theCrossSections = new G4PhysicsTable( numberOfElements );
|
||||
|
||||
// make a PhysicsVector for each element
|
||||
|
||||
static const G4ElementTable *theElementTable = G4Element::GetElementTable();
|
||||
for( G4int i=0; i<numberOfElements; ++i )
|
||||
(*theCrossSections)(i) =
|
||||
G4NeutronHPData::
|
||||
Instance()->MakePhysicsVector((*theElementTable)[i], this);
|
||||
}
|
||||
|
||||
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"<<endl;
|
||||
}
|
||||
|
||||
G4double G4NeutronHPFissionData::GetCrossSection(const G4DynamicParticle* aP, const G4Element*anE)
|
||||
{
|
||||
G4double result;
|
||||
G4bool outOfRange;
|
||||
G4int index = anE->GetIndex();
|
||||
|
||||
if(anE->GetZ()<90) return 0;
|
||||
result = (*((*theCrossSections)(index))).GetValue(
|
||||
aP->GetTotalMomentum()/GeV, outOfRange);
|
||||
return result;
|
||||
}
|
||||
@@ -0,0 +1,180 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHPFissionFS.hh"
|
||||
#include "G4Nucleus.hh"
|
||||
#include "G4DynamicParticleVector.hh"
|
||||
#include "G4NeutronHPFissionERelease.hh"
|
||||
void G4NeutronHPFissionFS::Init (G4double A, G4double Z, G4String & dirName, G4String & aFSType)
|
||||
{
|
||||
theFS.Init(A, Z, dirName, aFSType);
|
||||
theFC.Init(A, Z, dirName, aFSType);
|
||||
theSC.Init(A, Z, dirName, aFSType);
|
||||
theTC.Init(A, Z, dirName, aFSType);
|
||||
theLC.Init(A, Z, dirName, aFSType);
|
||||
}
|
||||
G4ParticleChange * G4NeutronHPFissionFS::ApplyYourself(const G4Track & theTrack)
|
||||
{
|
||||
theResult.Initialize(theTrack);
|
||||
|
||||
// prepare neutron
|
||||
G4double eKinetic = theTrack.GetKineticEnergy();
|
||||
const G4DynamicParticle *incidentParticle = theTrack.GetDynamicParticle();
|
||||
G4ReactionProduct theNeutron( incidentParticle->GetDefinition() );
|
||||
theNeutron.SetMomentum( incidentParticle->GetMomentum() );
|
||||
theNeutron.SetKineticEnergy( eKinetic );
|
||||
|
||||
// prepare target
|
||||
G4Nucleus aNucleus;
|
||||
G4ReactionProduct theTarget;
|
||||
G4double targetMass = theFS.GetMass();
|
||||
theTarget = aNucleus.GetThermalNucleus(targetMass);
|
||||
|
||||
// set neutron and target in the FS classes
|
||||
theFS.SetNeutron(theNeutron);
|
||||
theFS.SetTarget(theTarget);
|
||||
theFC.SetNeutron(theNeutron);
|
||||
theFC.SetTarget(theTarget);
|
||||
theSC.SetNeutron(theNeutron);
|
||||
theSC.SetTarget(theTarget);
|
||||
theTC.SetNeutron(theNeutron);
|
||||
theTC.SetTarget(theTarget);
|
||||
theLC.SetNeutron(theNeutron);
|
||||
theLC.SetTarget(theTarget);
|
||||
|
||||
// boost to target rest system and decide on channel.
|
||||
theNeutron.Lorentz(theNeutron, -1*theTarget);
|
||||
|
||||
// dice the photons
|
||||
|
||||
G4DynamicParticleVector * thePhotons;
|
||||
thePhotons = theFS.GetPhotons();
|
||||
|
||||
// select the FS in charge
|
||||
|
||||
eKinetic = theNeutron.GetKineticEnergy();
|
||||
G4double xSec[4];
|
||||
xSec[0] = theFC.GetXsec(eKinetic);
|
||||
xSec[1] = xSec[0]+theSC.GetXsec(eKinetic);
|
||||
xSec[2] = xSec[1]+theTC.GetXsec(eKinetic);
|
||||
xSec[3] = xSec[2]+theLC.GetXsec(eKinetic);
|
||||
G4int i, it;
|
||||
G4double random = G4UniformRand();
|
||||
for(i=0; i<4; i++)
|
||||
{
|
||||
it =i;
|
||||
if(random<xSec[i]/xSec[3]) break;
|
||||
}
|
||||
if(xSec[3]==0) it=-1;
|
||||
|
||||
// dice neutron multiplicities, energies and momenta in Lab. @@
|
||||
// no energy conservation on an event-to-event basis. we rely on the data to be ok. @@
|
||||
// also for mean, we rely on the consistancy of the data. @@
|
||||
|
||||
G4int Prompt=0, delayed=0, all=0;
|
||||
G4DynamicParticleVector * theNeutrons = NULL;
|
||||
switch(it) // check logic, and ask, if partials can be assumed to correspond to individual particles @@@
|
||||
{
|
||||
case 0:
|
||||
theFS.SampleNeutronMult(all, Prompt, delayed, eKinetic, 0);
|
||||
if(Prompt==0&&delayed==0) Prompt=all;
|
||||
theNeutrons = theFC.ApplyYourself(Prompt); // delayed always in FS
|
||||
// take 'U' into account explicitely (see 5.4) in the sampling of energy @@@@
|
||||
break;
|
||||
case 1:
|
||||
theFS.SampleNeutronMult(all, Prompt, delayed, eKinetic, 1);
|
||||
if(Prompt==0&&delayed==0) Prompt=all;
|
||||
theNeutrons = theSC.ApplyYourself(Prompt); // delayed always in FS, off done in FSFissionFS
|
||||
break;
|
||||
case 2:
|
||||
theFS.SampleNeutronMult(all, Prompt, delayed, eKinetic, 2);
|
||||
if(Prompt==0&&delayed==0) Prompt=all;
|
||||
theNeutrons = theTC.ApplyYourself(Prompt); // delayed always in FS
|
||||
break;
|
||||
case 3:
|
||||
theFS.SampleNeutronMult(all, Prompt, delayed, eKinetic, 3);
|
||||
if(Prompt==0&&delayed==0) Prompt=all;
|
||||
theNeutrons = theLC.ApplyYourself(Prompt); // delayed always in FS
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
// dice delayed neutrons and photons, and fallback
|
||||
// for Prompt in case channel had no FS data; add all paricles to FS.
|
||||
|
||||
G4double * theDecayConstants;
|
||||
|
||||
if(theNeutrons != NULL)
|
||||
{
|
||||
theDecayConstants = new G4double[delayed];
|
||||
G4int nPhotons = 0;
|
||||
if(thePhotons!=NULL) nPhotons = thePhotons->length();
|
||||
theResult.SetNumberOfSecondaries(nPhotons+Prompt+delayed);
|
||||
for(i=0; i<theNeutrons->length(); i++)
|
||||
{
|
||||
theResult.AddSecondary(theNeutrons->at(i));
|
||||
}
|
||||
delete theNeutrons;
|
||||
|
||||
G4DynamicParticleVector * theDelayed = NULL;
|
||||
theDelayed = theFS.ApplyYourself(0, delayed, theDecayConstants);
|
||||
for(i=0; i<theDelayed->length(); i++)
|
||||
{
|
||||
G4double time = -log(G4UniformRand())/theDecayConstants[i];
|
||||
time += theResult.GetTimeChange();
|
||||
theResult.AddSecondary(theDelayed->at(i), time);
|
||||
}
|
||||
delete theDelayed;
|
||||
}
|
||||
else
|
||||
{
|
||||
// cout << " all = "<<all<<endl;
|
||||
theFS.SampleNeutronMult(all, Prompt, delayed, eKinetic, 0);
|
||||
theDecayConstants = new G4double[delayed];
|
||||
if(Prompt==0&&delayed==0) Prompt=all;
|
||||
theNeutrons = theFS.ApplyYourself(Prompt, delayed, theDecayConstants);
|
||||
G4int nPhotons = 0;
|
||||
if(thePhotons!=NULL) nPhotons = thePhotons->length();
|
||||
theResult.SetNumberOfSecondaries(nPhotons+Prompt+delayed);
|
||||
for(i=0; i<Prompt; i++)
|
||||
{
|
||||
theResult.AddSecondary(theNeutrons->at(i));
|
||||
}
|
||||
for(i=Prompt; i<Prompt+delayed; i++)
|
||||
{
|
||||
G4double time = -log(G4UniformRand())/theDecayConstants[i-Prompt];
|
||||
time += theResult.GetTimeChange();
|
||||
theResult.AddSecondary(theNeutrons->at(i), time);
|
||||
}
|
||||
delete theNeutrons;
|
||||
}
|
||||
delete [] theDecayConstants;
|
||||
// cout << "all delayed "<<delayed<<endl;
|
||||
G4int nPhotons = 0;
|
||||
if(thePhotons!=NULL)
|
||||
{
|
||||
nPhotons = thePhotons->length();
|
||||
for(i=0; i<thePhotons->length(); i++)
|
||||
{
|
||||
theResult.AddSecondary(thePhotons->at(i));
|
||||
}
|
||||
delete thePhotons;
|
||||
}
|
||||
|
||||
// do some rotating, if that helps to conserve momentum @@@@
|
||||
|
||||
// finally deal with local energy depositions.
|
||||
// G4cout <<"Number of secondaries = "<<theResult.GetNumberOfSecondaries()<< endl;
|
||||
// G4cout <<"Number of Prompt = "<<Prompt<<endl;
|
||||
// G4cout <<"Number of delayed = "<<delayed<<endl;
|
||||
// G4cout <<"Number of photons = "<<nPhotons<<endl;
|
||||
G4NeutronHPFissionERelease * theERelease;
|
||||
theERelease = theFS.GetEnergyRelease();
|
||||
G4double eDepByFragments = theERelease->GetFragmentKinetic();
|
||||
theResult.SetLocalEnergyDeposit(eDepByFragments);
|
||||
// cout << "local energy deposit" << eDepByFragments<<endl;
|
||||
// clean up the primary neutron
|
||||
theResult.SetStatusChange(fStopAndKill);
|
||||
return &theResult;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHPGamma.hh"
|
||||
|
||||
G4bool G4NeutronHPGamma::Init(ifstream & aDataFile)
|
||||
{
|
||||
G4bool theResult = true;
|
||||
if(aDataFile >> levelEnergy)
|
||||
{
|
||||
aDataFile >> gammaEnergy >> probability;
|
||||
levelEnergy *= keV;
|
||||
gammaEnergy *= keV;
|
||||
}
|
||||
else
|
||||
{
|
||||
theResult=false;
|
||||
}
|
||||
return theResult;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHPHe3InelasticFS.hh"
|
||||
#include "G4Nucleus.hh"
|
||||
#include "G4He3.hh"
|
||||
|
||||
void G4NeutronHPHe3InelasticFS::Init (G4double A, G4double Z, G4String & dirName, G4String & aFSType)
|
||||
{
|
||||
G4NeutronHPInelasticCompFS::Init(A, Z, dirName, aFSType);
|
||||
G4double ResidualA = A-2;
|
||||
G4double ResidualZ = Z-2;
|
||||
G4NeutronHPInelasticCompFS::InitGammas(ResidualA, ResidualZ);
|
||||
}
|
||||
|
||||
G4ParticleChange * G4NeutronHPHe3InelasticFS::ApplyYourself(const G4Track & theTrack)
|
||||
{
|
||||
|
||||
// do the final state
|
||||
G4NeutronHPInelasticCompFS::CompositeApply(theTrack, G4He3::He3());
|
||||
|
||||
// return the result
|
||||
return &theResult;
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
// this code implementation is the intellectual property of
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
// 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: G4NeutronHPInelastic.cc,v 2.9 1998/12/01 17:43:57 hpw Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
#include "G4NeutronHPInelastic.hh"
|
||||
|
||||
G4NeutronHPInelastic::G4NeutronHPInelastic()
|
||||
{
|
||||
SetMinEnergy( 0.0 );
|
||||
SetMaxEnergy( 20.*MeV );
|
||||
system("echo $NeutronHPCrossSections");
|
||||
// G4cout << " entering G4NeutronHPInelastic constructor"<<endl;
|
||||
dirName = getenv("NeutronHPCrossSections");
|
||||
G4String tString = "/Inelastic/";
|
||||
dirName = dirName + tString;
|
||||
numEle = G4Element::GetNumberOfElements();
|
||||
theInelastic = new G4NeutronHPChannelList[numEle];
|
||||
G4bool toBeInitialised = true;
|
||||
|
||||
for (G4int i=0; i<numEle; i++)
|
||||
{
|
||||
theInelastic[i].Init((*(G4Element::GetElementTable()))(i), dirName);
|
||||
do
|
||||
{
|
||||
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");
|
||||
theInelastic[i].RestartRegistration();
|
||||
}
|
||||
while(!theInelastic[i].HasDataInAnyFinalState());
|
||||
}
|
||||
}
|
||||
G4NeutronHPInelastic::~G4NeutronHPInelastic()
|
||||
{
|
||||
delete [] theInelastic;
|
||||
}
|
||||
|
||||
G4VParticleChange * G4NeutronHPInelastic::ApplyYourself(const G4Track& aTrack, G4Nucleus& aTargetNucleus)
|
||||
{
|
||||
G4Material * theMaterial = aTrack.GetMaterial();
|
||||
G4int n = theMaterial->GetNumberOfElements();
|
||||
xSec = new G4double[n];
|
||||
G4double sum=0;
|
||||
G4int i, it, index;
|
||||
for (i=0; i<n; i++)
|
||||
{
|
||||
index = theMaterial->GetElement(i)->GetIndex();
|
||||
xSec[i] = theInelastic[index].GetXsec(aTrack.GetKineticEnergy());
|
||||
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;
|
||||
return theInelastic[index].ApplyYourself(theMaterial->GetElement(it), aTrack);
|
||||
}
|
||||
@@ -0,0 +1,365 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHPInelasticBaseFS.hh"
|
||||
#include "G4Nucleus.hh"
|
||||
#include "G4NucleiPropertiesTable.hh"
|
||||
#include "G4He3.hh"
|
||||
#include "G4Alpha.hh"
|
||||
#include "G4Electron.hh"
|
||||
#include "G4NeutronHPDataUsed.hh"
|
||||
|
||||
void G4NeutronHPInelasticBaseFS::InitGammas(G4double AR, G4double ZR)
|
||||
{
|
||||
char the[100] = {""};
|
||||
ostrstream ost(the, 100, ios::out);
|
||||
ost <<gammaPath<<"z"<<ZR<<".a"<<AR;
|
||||
G4String * aName = new G4String(the);
|
||||
ifstream from(*aName, ios::in);
|
||||
if(!from) return; // no data found for this isotope
|
||||
ifstream theGammaData(*aName, ios::in);
|
||||
|
||||
G4double eps = 0.001;
|
||||
theNuclearMassDifference =
|
||||
G4NucleiPropertiesTable::GetBindingEnergy(ZR+eps,AR+eps) -
|
||||
G4NucleiPropertiesTable::GetBindingEnergy(theBaseZ+eps, theBaseA+eps);
|
||||
theGammas.Init(theGammaData);
|
||||
delete aName;
|
||||
}
|
||||
|
||||
void G4NeutronHPInelasticBaseFS::Init (G4double A, G4double Z, G4String & dirName, G4String & bit)
|
||||
{
|
||||
gammaPath = "/Inelastic/Gammas/";
|
||||
G4String tBase = getenv("NeutronHPCrossSections");
|
||||
gammaPath = tBase+gammaPath;
|
||||
G4String tString = dirName;
|
||||
G4bool dbool;
|
||||
G4NeutronHPDataUsed aFile = theNames.GetName(A, Z, tString, bit, dbool);
|
||||
G4String filename = aFile.GetName();
|
||||
theBaseA = aFile.GetA();
|
||||
theBaseZ = aFile.GetZ();
|
||||
if(!dbool)
|
||||
{
|
||||
hasAnyData = false;
|
||||
hasFSData = false;
|
||||
hasXsec = false;
|
||||
return;
|
||||
}
|
||||
ifstream theData(filename, ios::in);
|
||||
if(!(theData))
|
||||
{
|
||||
hasAnyData = false;
|
||||
hasFSData = false;
|
||||
hasXsec = false;
|
||||
return; // no data for exactly this isotope and FS
|
||||
}
|
||||
// here we go
|
||||
G4int infoType, dataType, dummy=INT_MAX;
|
||||
hasFSData = false;
|
||||
while (theData >> infoType)
|
||||
{
|
||||
theData >> dataType;
|
||||
if(dummy==INT_MAX) theData >> dummy >> dummy;
|
||||
if(dataType==3)
|
||||
{
|
||||
G4int total;
|
||||
theData >> total;
|
||||
theXsection->Init(theData, total, eV);
|
||||
}
|
||||
else if(dataType==4)
|
||||
{
|
||||
theAngularDistribution = new G4NeutronHPAngular;
|
||||
theAngularDistribution->Init(theData);
|
||||
hasFSData = true;
|
||||
}
|
||||
else if(dataType==5)
|
||||
{
|
||||
theEnergyDistribution = new G4NeutronHPEnergyDistribution;
|
||||
theEnergyDistribution->Init(theData);
|
||||
hasFSData = true;
|
||||
}
|
||||
else if(dataType==6)
|
||||
{
|
||||
theEnergyAngData = new G4NeutronHPEnAngCorrelation;
|
||||
theEnergyAngData->Init(theData);
|
||||
hasFSData = true;
|
||||
}
|
||||
else if(dataType==12)
|
||||
{
|
||||
theFinalStatePhotons = new G4NeutronHPPhotonDist;
|
||||
theFinalStatePhotons->InitMean(theData);
|
||||
hasFSData = true;
|
||||
}
|
||||
else if(dataType==13)
|
||||
{
|
||||
theFinalStatePhotons = new G4NeutronHPPhotonDist;
|
||||
theFinalStatePhotons->InitPartials(theData);
|
||||
hasFSData = true;
|
||||
}
|
||||
else if(dataType==14)
|
||||
{
|
||||
theFinalStatePhotons->InitAngular(theData);
|
||||
hasFSData = true;
|
||||
}
|
||||
else if(dataType==15)
|
||||
{
|
||||
theFinalStatePhotons->InitEnergies(theData);
|
||||
hasFSData = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
G4Exception("Data-type unknown to G4NeutronHPInelasticBaseFS");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void G4NeutronHPInelasticBaseFS::BaseApply(const G4Track & theTrack,
|
||||
G4ParticleDefinition ** theDefs,
|
||||
G4int nDef)
|
||||
{
|
||||
theResult.Initialize(theTrack);
|
||||
|
||||
// prepare neutron
|
||||
G4double eKinetic = theTrack.GetKineticEnergy();
|
||||
const G4DynamicParticle *incidentParticle = theTrack.GetDynamicParticle();
|
||||
G4ReactionProduct theNeutron( incidentParticle->GetDefinition() );
|
||||
theNeutron.SetMomentum( incidentParticle->GetMomentum() );
|
||||
theNeutron.SetKineticEnergy( eKinetic );
|
||||
|
||||
// prepare target
|
||||
G4double targetMass;
|
||||
G4double eps = 0.0001;
|
||||
targetMass = ( G4NucleiPropertiesTable::GetAtomicMass(theBaseZ+eps, theBaseA+eps)-
|
||||
theBaseZ*G4Electron::ElectronDefinition()->GetPDGMass() ) /
|
||||
G4Neutron::Neutron()->GetPDGMass();
|
||||
if(theEnergyAngData!=NULL)
|
||||
targetMass = theEnergyAngData->GetTargetMass();
|
||||
if(theAngularDistribution!=NULL)
|
||||
targetMass = theAngularDistribution->GetTargetMass();
|
||||
G4Nucleus aNucleus;
|
||||
G4ReactionProduct theTarget;
|
||||
theTarget = aNucleus.GetThermalNucleus(targetMass);
|
||||
|
||||
// prepare energy in target rest frame
|
||||
G4ReactionProduct boosted;
|
||||
boosted.Lorentz(theNeutron, theTarget);
|
||||
eKinetic = boosted.GetKineticEnergy();
|
||||
|
||||
// Take N-body phase-space distribution, if no other data present.
|
||||
if(!HasFSData()) // adding the residual is trivial here @@@
|
||||
{
|
||||
G4NeutronHPNBodyPhaseSpace thePhaseSpaceDistribution;
|
||||
G4double aPhaseMass=0;
|
||||
G4int ii;
|
||||
for(ii=0; ii<nDef; ii++)
|
||||
{
|
||||
aPhaseMass+=theDefs[ii]->GetPDGMass();
|
||||
}
|
||||
theResult.SetNumberOfSecondaries(nDef);
|
||||
thePhaseSpaceDistribution.Init(aPhaseMass, nDef);
|
||||
thePhaseSpaceDistribution.SetNeutron(&theNeutron);
|
||||
thePhaseSpaceDistribution.SetTarget(&theTarget);
|
||||
for(ii=0; ii<nDef; ii++)
|
||||
{
|
||||
G4double massCode = 1000.*abs(theDefs[ii]->GetPDGCharge());
|
||||
massCode += theDefs[ii]->GetBaryonNumber();
|
||||
G4double dummy = 0;
|
||||
G4ReactionProduct * aSec = thePhaseSpaceDistribution.Sample(eKinetic, massCode, dummy);
|
||||
aSec->Lorentz(*aSec, -1.*theTarget);
|
||||
G4DynamicParticle * aPart = new G4DynamicParticle();
|
||||
aPart->SetDefinition(aSec->GetDefinition());
|
||||
aPart->SetMomentum(aSec->GetMomentum());
|
||||
delete aSec;
|
||||
theResult.AddSecondary(aPart);
|
||||
}
|
||||
theResult.SetStatusChange(fStopAndKill);
|
||||
return;
|
||||
}
|
||||
|
||||
// set target and neutron in the relevant exit channel
|
||||
if(theAngularDistribution!=NULL)
|
||||
{
|
||||
theAngularDistribution->SetTarget(theTarget);
|
||||
theAngularDistribution->SetNeutron(theNeutron);
|
||||
}
|
||||
else if(theEnergyAngData!=NULL)
|
||||
{
|
||||
theEnergyAngData->SetTarget(theTarget);
|
||||
theEnergyAngData->SetNeutron(theNeutron);
|
||||
}
|
||||
|
||||
G4ReactionProductVector * tmpHadrons = NULL;
|
||||
G4int i, ii, dummy;
|
||||
if(theEnergyAngData != NULL)
|
||||
{
|
||||
tmpHadrons = theEnergyAngData->Sample(eKinetic);
|
||||
}
|
||||
else if(theAngularDistribution!= NULL)
|
||||
{
|
||||
G4bool * Done = new G4bool[nDef];
|
||||
for(i=0; i<nDef; i++) Done[i] = false;
|
||||
if(tmpHadrons == NULL)
|
||||
{
|
||||
tmpHadrons = new G4ReactionProductVector;
|
||||
}
|
||||
else
|
||||
{
|
||||
for(i=0; i<tmpHadrons->length(); i++)
|
||||
{
|
||||
for(ii=0; ii<nDef; ii++)
|
||||
if(!Done[ii] && tmpHadrons->at(i)->GetDefinition() == theDefs[ii])
|
||||
Done[ii] = true;
|
||||
}
|
||||
}
|
||||
G4ReactionProduct * aHadron;
|
||||
for(i=0; i<nDef; i++)
|
||||
{
|
||||
if(!Done[i])
|
||||
{
|
||||
aHadron = new G4ReactionProduct;
|
||||
if(theEnergyDistribution!=NULL)
|
||||
{
|
||||
aHadron->SetDefinition(theDefs[i]);
|
||||
aHadron->SetKineticEnergy(theEnergyDistribution->Sample(eKinetic, dummy));
|
||||
}
|
||||
else
|
||||
{
|
||||
G4Exception("No energy distribution to sample from in InelasticBaseFS::BaseApply");
|
||||
}
|
||||
theAngularDistribution->SampleAndUpdate(*aHadron);
|
||||
tmpHadrons->insert(aHadron);
|
||||
}
|
||||
}
|
||||
delete [] Done;
|
||||
}
|
||||
else
|
||||
{
|
||||
G4Exception("No data to create the neutrons in NInelasticFS");
|
||||
}
|
||||
|
||||
G4ReactionProductVector * thePhotons = NULL;
|
||||
if(theFinalStatePhotons!=NULL)
|
||||
{
|
||||
// the photon distributions are in the Nucleus rest frame.
|
||||
G4ReactionProduct boosted;
|
||||
boosted.Lorentz(theNeutron, theTarget);
|
||||
G4double anEnergy = boosted.GetKineticEnergy();
|
||||
thePhotons = theFinalStatePhotons->GetPhotons(anEnergy);
|
||||
for(i=0; i<thePhotons->length(); i++)
|
||||
{
|
||||
// back to lab
|
||||
thePhotons->at(i)->Lorentz(*(thePhotons->at(i)), -1.*theTarget);
|
||||
}
|
||||
}
|
||||
else if(theEnergyAngData!=NULL)
|
||||
{
|
||||
G4double theGammaEnergy = theEnergyAngData->GetTotalMeanEnergy();
|
||||
G4double anEnergy = boosted.GetKineticEnergy();
|
||||
theGammaEnergy = anEnergy-theGammaEnergy;
|
||||
theGammaEnergy += theNuclearMassDifference;
|
||||
G4double eBindProducts = 0;
|
||||
G4double eBindN = 0;
|
||||
G4double eBindP = 0;
|
||||
G4double eBindD = G4NucleiPropertiesTable::GetBindingEnergy(1,2);
|
||||
G4double eBindT = G4NucleiPropertiesTable::GetBindingEnergy(1,3);
|
||||
G4double eBindHe3 = G4NucleiPropertiesTable::GetBindingEnergy(2,3);
|
||||
G4double eBindA = G4NucleiPropertiesTable::GetBindingEnergy(2,4);
|
||||
for(i=0; i<tmpHadrons->length(); i++)
|
||||
{
|
||||
if(tmpHadrons->at(i)->GetDefinition() == G4Neutron::Neutron())
|
||||
{
|
||||
eBindProducts+=eBindN;
|
||||
}
|
||||
else if(tmpHadrons->at(i)->GetDefinition() == G4Proton::Proton())
|
||||
{
|
||||
eBindProducts+=eBindP;
|
||||
}
|
||||
else if(tmpHadrons->at(i)->GetDefinition() == G4Deuteron::Deuteron())
|
||||
{
|
||||
eBindProducts+=eBindD;
|
||||
}
|
||||
else if(tmpHadrons->at(i)->GetDefinition() == G4Triton::Triton())
|
||||
{
|
||||
eBindProducts+=eBindT;
|
||||
}
|
||||
else if(tmpHadrons->at(i)->GetDefinition() == G4He3::He3())
|
||||
{
|
||||
eBindProducts+=eBindHe3;
|
||||
}
|
||||
else if(tmpHadrons->at(i)->GetDefinition() == G4Alpha::Alpha())
|
||||
{
|
||||
eBindProducts+=eBindA;
|
||||
}
|
||||
}
|
||||
theGammaEnergy += eBindProducts;
|
||||
|
||||
G4ReactionProductVector * theOtherPhotons = NULL;
|
||||
G4int iLevel;
|
||||
while(theGammaEnergy>=theGammas.GetLevelEnergy(0))
|
||||
{
|
||||
for(iLevel=theGammas.GetNumberOfLevels()-1; iLevel>=0; iLevel--)
|
||||
{
|
||||
if(theGammas.GetLevelEnergy(iLevel)<theGammaEnergy) break;
|
||||
}
|
||||
if(iLevel==0||iLevel==theGammas.GetNumberOfLevels()-1)
|
||||
{
|
||||
theOtherPhotons = theGammas.GetDecayGammas(iLevel);
|
||||
}
|
||||
else
|
||||
{
|
||||
G4double random = G4UniformRand();
|
||||
G4double eLow = theGammas.GetLevelEnergy(iLevel);
|
||||
G4double eHigh = theGammas.GetLevelEnergy(iLevel+1);
|
||||
if(random > (eHigh-eLow)/(theGammaEnergy-eLow)) iLevel++;
|
||||
theOtherPhotons = theGammas.GetDecayGammas(iLevel);
|
||||
}
|
||||
if(thePhotons==NULL) thePhotons = new G4ReactionProductVector;
|
||||
if(theOtherPhotons != NULL)
|
||||
{
|
||||
for(G4int ii=0; ii<theOtherPhotons->length(); ii++)
|
||||
{
|
||||
thePhotons->insert(theOtherPhotons->at(ii));
|
||||
}
|
||||
delete theOtherPhotons;
|
||||
}
|
||||
theGammaEnergy -= theGammas.GetLevelEnergy(iLevel);
|
||||
if(iLevel == -1) break;
|
||||
}
|
||||
}
|
||||
|
||||
// fill the result
|
||||
G4int nSecondaries = tmpHadrons->length();
|
||||
G4int nPhotons = 0;
|
||||
if(thePhotons!=NULL) nPhotons = thePhotons->length();
|
||||
nSecondaries += nPhotons;
|
||||
theResult.SetNumberOfSecondaries(nSecondaries);
|
||||
G4DynamicParticle * theSec;
|
||||
|
||||
for(i=0; i<nSecondaries-nPhotons; i++)
|
||||
{
|
||||
theSec = new G4DynamicParticle;
|
||||
theSec->SetDefinition(tmpHadrons->at(i)->GetDefinition());
|
||||
theSec->SetMomentum(tmpHadrons->at(i)->GetMomentum());
|
||||
theResult.AddSecondary(theSec);
|
||||
delete tmpHadrons->at(i);
|
||||
}
|
||||
if(thePhotons != NULL)
|
||||
{
|
||||
for(i=0; i<nPhotons; i++)
|
||||
{
|
||||
theSec = new G4DynamicParticle;
|
||||
theSec->SetDefinition(thePhotons->at(i)->GetDefinition());
|
||||
theSec->SetMomentum(thePhotons->at(i)->GetMomentum());
|
||||
theResult.AddSecondary(theSec);
|
||||
delete thePhotons->at(i);
|
||||
}
|
||||
}
|
||||
|
||||
// some garbage collection
|
||||
delete thePhotons;
|
||||
delete tmpHadrons;
|
||||
|
||||
// clean up the primary neutron
|
||||
theResult.SetStatusChange(fStopAndKill);
|
||||
}
|
||||
@@ -0,0 +1,341 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHPInelasticCompFS.hh"
|
||||
#include "G4Nucleus.hh"
|
||||
#include "G4NucleiPropertiesTable.hh"
|
||||
#include "G4He3.hh"
|
||||
#include "G4Alpha.hh"
|
||||
#include "G4Electron.hh"
|
||||
#include "G4NeutronHPDataUsed.hh"
|
||||
|
||||
void G4NeutronHPInelasticCompFS::InitGammas(G4double AR, G4double ZR)
|
||||
{
|
||||
char the[100] = {""};
|
||||
ostrstream ost(the, 100, ios::out);
|
||||
ost <<gammaPath<<"z"<<ZR<<".a"<<AR;
|
||||
G4String * aName = new G4String(the);
|
||||
ifstream from(*aName, ios::in);
|
||||
if(!from) return; // no data found for this isotope
|
||||
ifstream theGammaData(*aName, ios::in);
|
||||
|
||||
theGammas.Init(theGammaData);
|
||||
delete aName;
|
||||
}
|
||||
|
||||
void G4NeutronHPInelasticCompFS::Init (G4double A, G4double Z, G4String & dirName, G4String & aFSType)
|
||||
{
|
||||
gammaPath = "/Inelastic/Gammas/";
|
||||
G4String tBase = getenv("NeutronHPCrossSections");
|
||||
gammaPath = tBase+gammaPath;
|
||||
G4String tString = dirName;
|
||||
G4bool dbool;
|
||||
G4NeutronHPDataUsed aFile = theNames.GetName(A, Z, tString, aFSType, dbool);
|
||||
G4String filename = aFile.GetName();
|
||||
theBaseA = aFile.GetA();
|
||||
theBaseZ = aFile.GetZ();
|
||||
if(!dbool)
|
||||
{
|
||||
hasAnyData = false;
|
||||
hasFSData = false;
|
||||
hasXsec = false;
|
||||
return;
|
||||
}
|
||||
ifstream theData(filename, ios::in);
|
||||
if(!theData)
|
||||
{
|
||||
hasAnyData = false;
|
||||
hasFSData = false;
|
||||
hasXsec = false;
|
||||
return;
|
||||
}
|
||||
// here we go
|
||||
G4int infoType, dataType, dummy;
|
||||
G4int sfType, it;
|
||||
hasFSData = false;
|
||||
while (theData >> infoType)
|
||||
{
|
||||
hasFSData = true;
|
||||
theData >> dataType;
|
||||
theData >> sfType >> dummy;
|
||||
it = 50;
|
||||
if(sfType>600||(sfType<100&&sfType>50)) it = sfType%50;
|
||||
if(dataType==3)
|
||||
{
|
||||
theData >> dummy >> dummy;
|
||||
theXsection[it] = new G4NeutronHPVector;
|
||||
G4int total;
|
||||
theData >> total;
|
||||
theXsection[it]->Init(theData, total, eV);
|
||||
}
|
||||
else if(dataType==4)
|
||||
{
|
||||
theAngularDistribution[it] = new G4NeutronHPAngular;
|
||||
theAngularDistribution[it]->Init(theData);
|
||||
}
|
||||
else if(dataType==5)
|
||||
{
|
||||
theEnergyDistribution[it] = new G4NeutronHPEnergyDistribution;
|
||||
theEnergyDistribution[it]->Init(theData);
|
||||
}
|
||||
else if(dataType==6)
|
||||
{
|
||||
theEnergyAngData[it] = new G4NeutronHPEnAngCorrelation;
|
||||
theEnergyAngData[it]->Init(theData);
|
||||
}
|
||||
else if(dataType==12)
|
||||
{
|
||||
theFinalStatePhotons[it] = new G4NeutronHPPhotonDist;
|
||||
theFinalStatePhotons[it]->InitMean(theData);
|
||||
}
|
||||
else if(dataType==13)
|
||||
{
|
||||
theFinalStatePhotons[it] = new G4NeutronHPPhotonDist;
|
||||
theFinalStatePhotons[it]->InitPartials(theData);
|
||||
}
|
||||
else if(dataType==14)
|
||||
{
|
||||
theFinalStatePhotons[it]->InitAngular(theData);
|
||||
}
|
||||
else if(dataType==15)
|
||||
{
|
||||
theFinalStatePhotons[it]->InitEnergies(theData);
|
||||
}
|
||||
else
|
||||
{
|
||||
G4Exception("Data-type unknown to G4NeutronHPInelasticCompFS");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
G4int G4NeutronHPInelasticCompFS::SelectExitChannel(G4double eKinetic)
|
||||
{
|
||||
G4double running[50];
|
||||
running[0] = 0;
|
||||
G4int i;
|
||||
for(i=0; i<50; i++)
|
||||
{
|
||||
if(i!=0) running[i]=running[i-1];
|
||||
if(theXsection[i] != NULL)
|
||||
{
|
||||
running[i] += theXsection[i]->GetXsec(eKinetic);
|
||||
}
|
||||
}
|
||||
G4double random = G4UniformRand();
|
||||
G4double sum = running[49];
|
||||
G4int it = 0;
|
||||
for(i=0; i<50; i++)
|
||||
{
|
||||
it = i;
|
||||
if(random < running[i]/sum) break;
|
||||
}
|
||||
//debug: it = 1;
|
||||
return it;
|
||||
}
|
||||
|
||||
void G4NeutronHPInelasticCompFS::CompositeApply(const G4Track & theTrack, G4ParticleDefinition * aDefinition)
|
||||
{
|
||||
theResult.Initialize(theTrack);
|
||||
|
||||
// prepare neutron
|
||||
G4double eKinetic = theTrack.GetKineticEnergy();
|
||||
const G4DynamicParticle *incidentParticle = theTrack.GetDynamicParticle();
|
||||
G4ReactionProduct theNeutron( incidentParticle->GetDefinition() );
|
||||
theNeutron.SetMomentum( incidentParticle->GetMomentum() );
|
||||
theNeutron.SetKineticEnergy( eKinetic );
|
||||
|
||||
// prepare target
|
||||
G4int i;
|
||||
for(i=0; i<50; i++) if(theXsection[i] != NULL) break;
|
||||
G4double targetMass=0;
|
||||
G4double eps = 0.0001;
|
||||
targetMass = ( G4NucleiPropertiesTable::GetAtomicMass(theBaseZ+eps, theBaseA+eps)-
|
||||
theBaseZ*G4Electron::ElectronDefinition()->GetPDGMass() ) /
|
||||
G4Neutron::Neutron()->GetPDGMass();
|
||||
if(theEnergyAngData[i]!=NULL)
|
||||
targetMass = theEnergyAngData[i]->GetTargetMass();
|
||||
else if(theAngularDistribution[i]!=NULL)
|
||||
targetMass = theAngularDistribution[i]->GetTargetMass();
|
||||
else if(theFinalStatePhotons[50]!=NULL)
|
||||
targetMass = theFinalStatePhotons[50]->GetTargetMass();
|
||||
G4Nucleus aNucleus;
|
||||
G4ReactionProduct theTarget;
|
||||
theTarget = aNucleus.GetThermalNucleus(targetMass);
|
||||
|
||||
// prepare the residual mass
|
||||
G4double residualMass=0;
|
||||
G4double residualZ = theBaseZ - aDefinition->GetPDGCharge();
|
||||
G4double residualA = theBaseA - aDefinition->GetBaryonNumber()+1;
|
||||
residualMass = ( G4NucleiPropertiesTable::GetAtomicMass(residualZ+eps, residualA+eps)-
|
||||
residualZ*G4Electron::ElectronDefinition()->GetPDGMass() ) /
|
||||
G4Neutron::Neutron()->GetPDGMass();
|
||||
|
||||
// prepare energy in target rest frame
|
||||
G4ReactionProduct boosted;
|
||||
boosted.Lorentz(theNeutron, theTarget);
|
||||
eKinetic = boosted.GetKineticEnergy();
|
||||
|
||||
// select exit channel for composite FS class.
|
||||
G4int it = SelectExitChannel(eKinetic);
|
||||
|
||||
// set target and neutron in the relevant exit channel
|
||||
InitDistributionInitialState(theNeutron, theTarget, it);
|
||||
|
||||
G4ReactionProductVector * thePhotons = NULL;
|
||||
G4ReactionProductVector * theParticles = NULL;
|
||||
G4ReactionProduct aHadron;
|
||||
aHadron.SetDefinition(aDefinition); // what if only cross-sections exist ==> Na 23 11 @@@@
|
||||
aHadron.SetKineticEnergy(theNeutron.GetKineticEnergy() +
|
||||
theNeutron.GetMass() - aHadron.GetMass() +
|
||||
(targetMass - residualMass)*G4Neutron::Neutron()->GetPDGMass());
|
||||
aHadron.SetMomentum(theNeutron.GetMomentum()*(1./theNeutron.GetTotalMomentum())*
|
||||
sqrt(aHadron.GetTotalEnergy()*aHadron.GetTotalEnergy()-
|
||||
aHadron.GetMass()*aHadron.GetMass())
|
||||
);
|
||||
G4int dummy;
|
||||
G4int nSecGamma = 0;
|
||||
G4double eGamm = 0;
|
||||
G4int iLevel=it-1;
|
||||
while( iLevel!=-1 && theGammas.GetLevel(iLevel)==NULL ) iLevel--;
|
||||
if(theAngularDistribution[it]!= NULL)
|
||||
{
|
||||
if(theEnergyDistribution[it]!=NULL)
|
||||
{
|
||||
aHadron.SetKineticEnergy(theEnergyDistribution[it]->Sample(eKinetic, dummy));
|
||||
G4double eSecN = aHadron.GetKineticEnergy();
|
||||
eGamm = eKinetic-eSecN;
|
||||
for(iLevel=theGammas.GetNumberOfLevels()-1; iLevel>=0; iLevel--)
|
||||
{
|
||||
if(theGammas.GetLevelEnergy(iLevel)<eGamm) break;
|
||||
}
|
||||
G4double random = 2*G4UniformRand();
|
||||
iLevel+=G4int(random);
|
||||
if(iLevel>theGammas.GetNumberOfLevels()-1)iLevel = theGammas.GetNumberOfLevels()-1;
|
||||
}
|
||||
else
|
||||
{
|
||||
G4double eExcitation = 0;
|
||||
if(iLevel>=0) eExcitation = theGammas.GetLevel(iLevel)->GetLevelEnergy();
|
||||
aHadron.SetKineticEnergy(eKinetic - eExcitation);
|
||||
}
|
||||
theAngularDistribution[it]->SampleAndUpdate(aHadron);
|
||||
if(theFinalStatePhotons[it] == NULL)
|
||||
{
|
||||
thePhotons = theGammas.GetDecayGammas(iLevel);
|
||||
eGamm -= theGammas.GetLevelEnergy(iLevel);
|
||||
if(eGamm>0) // @ ok for now, but really needs an efficient way of correllated sampling @
|
||||
{
|
||||
G4ReactionProduct * theRestEnergy = new G4ReactionProduct;
|
||||
theRestEnergy->SetDefinition(G4Gamma::Gamma());
|
||||
theRestEnergy->SetKineticEnergy(eGamm);
|
||||
G4double costh = 2.*G4UniformRand()-1.;
|
||||
G4double phi = twopi*G4UniformRand();
|
||||
theRestEnergy->SetMomentum(eGamm*sin(acos(costh))*cos(phi),
|
||||
eGamm*sin(acos(costh))*sin(phi),
|
||||
eGamm*costh);
|
||||
if(thePhotons == NULL) thePhotons = new G4ReactionProductVector;
|
||||
thePhotons->insert(theRestEnergy);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(theEnergyAngData[it]!= NULL)
|
||||
{
|
||||
theParticles = theEnergyAngData[it]->Sample(eKinetic);
|
||||
}
|
||||
else
|
||||
{
|
||||
// @@@ what to do, if we have photon data, but no info on the proton itself
|
||||
}
|
||||
if(theFinalStatePhotons[it]!=NULL)
|
||||
{
|
||||
// the photon distributions are in the Nucleus rest frame.
|
||||
G4ReactionProduct boosted;
|
||||
boosted.Lorentz(theNeutron, theTarget);
|
||||
G4double anEnergy = boosted.GetKineticEnergy();
|
||||
thePhotons = theFinalStatePhotons[it]->GetPhotons(anEnergy);
|
||||
G4double aBaseEnergy = theFinalStatePhotons[it]->GetLevelEnergy();
|
||||
G4double testEnergy = 0;
|
||||
if(thePhotons!=NULL && thePhotons->entries()!=0) aBaseEnergy-=thePhotons->at(0)->GetTotalEnergy();
|
||||
if(theFinalStatePhotons[it]->NeedsCascade())
|
||||
{
|
||||
while(abs(aBaseEnergy)>0.01*keV)
|
||||
{
|
||||
// cascade down the levels
|
||||
for(G4int i=1; i<it; i++)
|
||||
{
|
||||
if(theFinalStatePhotons[i]!=NULL)
|
||||
{
|
||||
testEnergy = theFinalStatePhotons[i]->GetLevelEnergy();
|
||||
}
|
||||
else
|
||||
{
|
||||
testEnergy = 0;
|
||||
}
|
||||
if(abs(testEnergy-aBaseEnergy)<0.1*keV)
|
||||
{
|
||||
G4ReactionProductVector * theNext =
|
||||
theFinalStatePhotons[i]->GetPhotons(anEnergy);
|
||||
thePhotons->insert(theNext->at(0));
|
||||
aBaseEnergy = testEnergy-theNext->at(0)->GetTotalEnergy();
|
||||
delete theNext;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} // <=== the break goes here.
|
||||
}
|
||||
}
|
||||
if(thePhotons!=NULL)
|
||||
{
|
||||
for(i=0; i<thePhotons->length(); i++)
|
||||
{
|
||||
// back to lab
|
||||
thePhotons->at(i)->Lorentz(*(thePhotons->at(i)), -1.*theTarget);
|
||||
}
|
||||
}
|
||||
|
||||
// fill the result
|
||||
G4int nSecondaries = 1; // the hadron
|
||||
if(theParticles != NULL) nSecondaries = theParticles->length();
|
||||
G4int nPhotons = 0;
|
||||
if(thePhotons!=NULL) nPhotons = thePhotons->length();
|
||||
nSecondaries += nPhotons;
|
||||
theResult.SetNumberOfSecondaries(nSecondaries);
|
||||
|
||||
G4DynamicParticle * theSec;
|
||||
|
||||
if( theParticles==NULL )
|
||||
{
|
||||
theSec = new G4DynamicParticle;
|
||||
theSec->SetDefinition(aHadron.GetDefinition());
|
||||
theSec->SetMomentum(aHadron.GetMomentum());
|
||||
theResult.AddSecondary(theSec);
|
||||
}
|
||||
else
|
||||
{
|
||||
for(i=0; i<theParticles->length(); i++)
|
||||
{
|
||||
theSec = new G4DynamicParticle;
|
||||
theSec->SetDefinition(theParticles->at(i)->GetDefinition());
|
||||
theSec->SetMomentum(theParticles->at(i)->GetMomentum());
|
||||
theResult.AddSecondary(theSec);
|
||||
delete theParticles->at(i);
|
||||
}
|
||||
delete theParticles;
|
||||
}
|
||||
if(thePhotons!=NULL)
|
||||
{
|
||||
for(i=0; i<nPhotons; i++)
|
||||
{
|
||||
theSec = new G4DynamicParticle;
|
||||
theSec->SetDefinition(G4Gamma::Gamma());
|
||||
theSec->SetMomentum(thePhotons->at(i)->GetMomentum());
|
||||
theResult.AddSecondary(theSec);
|
||||
delete thePhotons->at(i);
|
||||
}
|
||||
// some garbage collection
|
||||
delete thePhotons;
|
||||
}
|
||||
// clean up the primary neutron
|
||||
theResult.SetStatusChange(fStopAndKill);
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHPInelasticData.hh"
|
||||
#include "G4Neutron.hh"
|
||||
#include "G4ElementTable.hh"
|
||||
#include "G4NeutronHPData.hh"
|
||||
|
||||
G4bool G4NeutronHPInelasticData::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;
|
||||
}
|
||||
|
||||
G4NeutronHPInelasticData::G4NeutronHPInelasticData()
|
||||
{
|
||||
BuildPhysicsTable(*G4Neutron::Neutron());
|
||||
}
|
||||
|
||||
G4NeutronHPInelasticData::~G4NeutronHPInelasticData()
|
||||
{
|
||||
delete theCrossSections;
|
||||
}
|
||||
|
||||
void G4NeutronHPInelasticData::BuildPhysicsTable(const G4ParticleDefinition& aP)
|
||||
{
|
||||
if(&aP!=G4Neutron::Neutron())
|
||||
G4Exception("Attempt to use NeutronHP data for particles other than neutrons!!!");
|
||||
G4int numberOfElements = G4Element::GetNumberOfElements();
|
||||
theCrossSections = new G4PhysicsTable( numberOfElements );
|
||||
|
||||
// make a PhysicsVector for each element
|
||||
|
||||
static const G4ElementTable *theElementTable = G4Element::GetElementTable();
|
||||
for( G4int i=0; i<numberOfElements; ++i )
|
||||
(*theCrossSections)(i) =
|
||||
G4NeutronHPData::
|
||||
Instance()->MakePhysicsVector((*theElementTable)[i], this);
|
||||
}
|
||||
|
||||
void G4NeutronHPInelasticData::DumpPhysicsTable(const G4ParticleDefinition& aP)
|
||||
{
|
||||
if(&aP!=G4Neutron::Neutron())
|
||||
G4Exception("Attempt to use NeutronHP data for particles other than neutrons!!!");
|
||||
G4cout << "G4NeutronHPInelasticData::DumpPhysicsTable still to be implemented"<<endl;
|
||||
}
|
||||
|
||||
G4double G4NeutronHPInelasticData::GetCrossSection(const G4DynamicParticle* aP, const G4Element*anE)
|
||||
{
|
||||
G4double result;
|
||||
G4bool outOfRange;
|
||||
G4int index = anE->GetIndex();
|
||||
|
||||
result = (*((*theCrossSections)(index))).GetValue(
|
||||
aP->GetTotalMomentum()/GeV, outOfRange);
|
||||
return result;
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHPInterpolator.hh"
|
||||
|
||||
G4double G4NeutronHPInterpolator::
|
||||
GetBinIntegral(const G4InterpolationScheme & aScheme,
|
||||
const G4double x1,const G4double x2,const G4double y1,const G4double y2)
|
||||
{ // inline again later on @@@@
|
||||
G4double result = 0;
|
||||
if(aScheme==HISTO||aScheme==CHISTO||aScheme==UHISTO)
|
||||
{
|
||||
result = y1*(x2-x1);
|
||||
}
|
||||
else if(aScheme==LINLIN||aScheme==CLINLIN||aScheme==ULINLIN)
|
||||
{
|
||||
result = 0.5*(y2+y1)*(x2-x1);
|
||||
}
|
||||
else if(aScheme==LINLOG||aScheme==CLINLOG||aScheme==ULINLOG)
|
||||
{
|
||||
G4double b = (y2-y1)/(log(x2)-log(x1));
|
||||
G4double a = y1 - b*log(x1);
|
||||
result = (a-b)*(x2-x1) + b*(x2*log(x2)-x1*log(x1));
|
||||
}
|
||||
else if(aScheme==LOGLIN||aScheme==CLOGLIN||aScheme==ULOGLIN)
|
||||
{
|
||||
G4double b = (log(y2)-log(y1))/(x2-x1);
|
||||
G4double a = log(y1) - b*x1;
|
||||
result = (exp(a)/b)*(exp(b*x2)-exp(b*x1));
|
||||
}
|
||||
else if(aScheme==LOGLOG||aScheme==CLOGLOG||aScheme==ULOGLOG)
|
||||
{
|
||||
G4double b = (log(y2)-log(y1))/(log(x2)-log(x1));
|
||||
G4double a = log(y1) - b*log(x1);;
|
||||
result = (exp(a)/(b+1))*(pow(x2,b+1)-pow(x1,b+1));
|
||||
}
|
||||
else
|
||||
{
|
||||
G4Exception("Unknown interpolation scheme in G4NeutronHPVector::Integrate");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
G4double G4NeutronHPInterpolator::
|
||||
GetWeightedBinIntegral(const G4InterpolationScheme & aScheme,
|
||||
const G4double x1,const G4double x2,const G4double y1,const G4double y2)
|
||||
{ // inline again later on @@@@
|
||||
G4double result = 0;
|
||||
if(aScheme==HISTO||aScheme==CHISTO||aScheme==UHISTO)
|
||||
{
|
||||
result = 0.5*y1*(x2*x2-x1*x1);
|
||||
}
|
||||
else if(aScheme==LINLIN||aScheme==CLINLIN||aScheme==ULINLIN)
|
||||
{
|
||||
G4double b = (y2-y1)/(x2-x1);
|
||||
G4double a = y1 - b*x1;
|
||||
result = 0.5*a*(x2*x2-x1*x1) + (b/3.)*(x2*x2*x2-x1*x1*x1);
|
||||
}
|
||||
else if(aScheme==LINLOG||aScheme==CLINLOG||aScheme==ULINLOG)
|
||||
{
|
||||
G4double b = (y2-y1)/(log(x2)-log(x1));
|
||||
G4double a = y1 - b*log(x1);
|
||||
result = ( x2*x2/2. * (a-b/2.+b*log(x2)) )
|
||||
-( x1*x1/2. * (a-b/2.+b*log(x1)) );
|
||||
}
|
||||
else if(aScheme==LOGLIN||aScheme==CLOGLIN||aScheme==ULOGLIN)
|
||||
{
|
||||
G4double b = (log(y2)-log(y1))/(x2-x1);
|
||||
G4double a = log(y1) - b*x1;
|
||||
result = exp(a)/(b*b)*( exp(b*x2)*(b*x2-1.) - exp(b*x1)*(b*x1-1.) );
|
||||
}
|
||||
else if(aScheme==LOGLOG||aScheme==CLOGLOG||aScheme==ULOGLOG)
|
||||
{
|
||||
G4double b = (log(y2)-log(y1))/(log(x2)-log(x1));
|
||||
G4double a = log(y1) - b*log(x1);;
|
||||
result = exp(a)/(b+2.)*( pow(x2, b+2.) - pow(x1, b+2) );
|
||||
}
|
||||
else
|
||||
{
|
||||
G4Exception("Unknown interpolation scheme in G4NeutronHPVector::Integrate");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHPIsoData.hh"
|
||||
#include "G4NeutronHPDataUsed.hh"
|
||||
|
||||
G4bool G4NeutronHPIsoData::Init(G4int A, G4int Z, G4double abun, G4String dirName, G4String aFSType)
|
||||
{
|
||||
theChannelData = NULL;
|
||||
G4double abundance = abun/100.;
|
||||
G4String filename;
|
||||
G4bool result = true;
|
||||
G4NeutronHPDataUsed aFile = theNames.GetName(A, Z, dirName, aFSType, result);
|
||||
filename = aFile.GetName();
|
||||
// if(filename=="") return false;
|
||||
ifstream theChannel(filename);
|
||||
if(!theChannel) return false;
|
||||
// accommodating deficiencie of some compilers
|
||||
if(theChannel.eof()) return false;
|
||||
if(!theChannel) return false;
|
||||
G4int count;
|
||||
G4int dummy;
|
||||
theChannel >> dummy >> dummy;
|
||||
theChannelData = new G4NeutronHPVector;
|
||||
G4int nData;
|
||||
theChannel >> nData;
|
||||
theChannelData->Init(theChannel, nData, eV, abundance*barn);
|
||||
// G4cout << "Channel Data Statistics: "<<theChannelData->GetVectorLength()<<endl;
|
||||
// G4cout << "Channel data"<<endl;
|
||||
// G4int hpw;
|
||||
// cin >> hpw;
|
||||
// theChannelData->Dump();
|
||||
return result;
|
||||
}
|
||||
|
||||
void G4NeutronHPIsoData::Init(G4int A, G4int Z, G4double abun) //fill PhysicsVector for this Isotope
|
||||
{
|
||||
G4String dirName;
|
||||
G4String baseName = getenv("NeutronHPCrossSections");
|
||||
dirName = baseName+"/Fission";
|
||||
if(Z>89)
|
||||
{
|
||||
Init(A, Z, abun, dirName, "/CrossSection/");
|
||||
}
|
||||
else
|
||||
{
|
||||
theChannelData = new G4NeutronHPVector;
|
||||
}
|
||||
theFissionData = theChannelData;
|
||||
dirName = baseName+"/Capture";
|
||||
Init(A, Z, abun, dirName, "/CrossSection/");
|
||||
theCaptureData = theChannelData;
|
||||
dirName = baseName+"/Elastic";
|
||||
Init(A, Z, abun, dirName, "/CrossSection/");
|
||||
theElasticData = theChannelData;
|
||||
dirName = baseName+"/Inelastic";
|
||||
Init(A, Z, abun, dirName, "/CrossSection/");
|
||||
theInelasticData = theChannelData;
|
||||
|
||||
// if(theInelasticData!=NULL) G4cout << "Inelastic Data Statistics: "<<theInelasticData->GetVectorLength()<<endl;
|
||||
// if(theElasticData!=NULL) G4cout << "Elastic Data Statistics: "<<theElasticData->GetVectorLength()<<endl;
|
||||
// if(theCaptureData!=NULL) G4cout << "Capture Data Statistics: "<<theCaptureData->GetVectorLength()<<endl;
|
||||
// if(theFissionData!=NULL) G4cout << "Fission Data Statistics: "<<theFissionData->GetVectorLength()<<endl;
|
||||
// G4cout << "Inelastic data"<<endl;
|
||||
// if(theInelasticData!=NULL) theInelasticData->Dump();
|
||||
// G4cout << "Elastic data"<<endl;
|
||||
// if(theElasticData!=NULL) theElasticData->Dump();
|
||||
// G4cout << "Capture data"<<endl;
|
||||
// if(theCaptureData!=NULL) theCaptureData->Dump();
|
||||
// G4cout << "Fission data"<<endl;
|
||||
// if(theFissionData!=NULL) theFissionData->Dump();
|
||||
|
||||
}
|
||||
|
||||
G4String G4NeutronHPIsoData::GetName(G4int A, G4int Z, G4String base, G4String rest)
|
||||
{
|
||||
G4bool dbool;
|
||||
return (theNames.GetName(A, Z, base, rest, dbool)).GetName();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHPIsotropic.hh"
|
||||
#include "Randomize.hh"
|
||||
#include "G4Gamma.hh"
|
||||
#include "G4Electron.hh"
|
||||
#include "G4Positron.hh"
|
||||
#include "G4Neutron.hh"
|
||||
#include "G4Proton.hh"
|
||||
#include "G4Deuteron.hh"
|
||||
#include "G4Triton.hh"
|
||||
#include "G4He3.hh"
|
||||
#include "G4Alpha.hh"
|
||||
|
||||
void G4NeutronHPIsotropic::Init(ifstream & aDataFile)
|
||||
{
|
||||
}
|
||||
|
||||
G4ReactionProduct * G4NeutronHPIsotropic::Sample(G4double anEnergy, G4double massCode, G4double mass)
|
||||
{
|
||||
G4ReactionProduct * result = new G4ReactionProduct;
|
||||
G4int Z = massCode/1000;
|
||||
G4int A = massCode-1000*Z;
|
||||
|
||||
if(massCode==0)
|
||||
{
|
||||
result->SetDefinition(G4Gamma::Gamma());
|
||||
}
|
||||
else if(A==0)
|
||||
{
|
||||
result->SetDefinition(G4Electron::Electron());
|
||||
if(Z==1) result->SetDefinition(G4Positron::Positron());
|
||||
}
|
||||
else if(A==1)
|
||||
{
|
||||
result->SetDefinition(G4Neutron::Neutron());
|
||||
if(Z==1) result->SetDefinition(G4Proton::Proton());
|
||||
}
|
||||
else if(A==2)
|
||||
{
|
||||
result->SetDefinition(G4Deuteron::Deuteron());
|
||||
}
|
||||
else if(A==3)
|
||||
{
|
||||
result->SetDefinition(G4Triton::Triton());
|
||||
if(Z==2) result->SetDefinition(G4He3::He3());
|
||||
}
|
||||
else if(A==4)
|
||||
{
|
||||
result->SetDefinition(G4Alpha::Alpha());
|
||||
if(Z!=2) G4Exception("Unknown ion case 1");
|
||||
}
|
||||
else
|
||||
{
|
||||
G4Exception("G4NeutronHPIsotropic: Unknown ion case 2");
|
||||
}
|
||||
|
||||
G4double cosTh = G4UniformRand();
|
||||
G4double phi = twopi*G4UniformRand();
|
||||
G4double theta = acos(cosTh);
|
||||
G4double sinth = sin(theta);
|
||||
|
||||
// we need the the Q value of the reaction
|
||||
result->SetKineticEnergy(max(0.001*MeV, anEnergy+GetQValue()));
|
||||
G4double mtot = result->GetTotalMomentum();
|
||||
G4ThreeVector tempVector(mtot*sinth*cos(phi), mtot*sinth*sin(phi), mtot*cos(theta) );
|
||||
result->SetMomentum(tempVector);
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHPKallbachMannSyst.hh"
|
||||
#include "Randomize.hh"
|
||||
|
||||
G4double G4NeutronHPKallbachMannSyst::Sample(G4double anEnergy)
|
||||
{
|
||||
G4double result;
|
||||
|
||||
G4double zero = GetKallbachZero(anEnergy);
|
||||
if(zero>1) zero=1.;
|
||||
if(zero<-1)zero=-1.;
|
||||
G4double max = Kallbach(zero, anEnergy);
|
||||
double upper = Kallbach(1., anEnergy);
|
||||
double lower = Kallbach(-1., anEnergy);
|
||||
if(upper>max) max=upper;
|
||||
if(lower>max) max=lower;
|
||||
G4double value, random;
|
||||
do
|
||||
{
|
||||
result = 2.*G4UniformRand()-1;
|
||||
value = Kallbach(result, anEnergy)/max;
|
||||
random = G4UniformRand();
|
||||
}
|
||||
while(random>value);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
G4double G4NeutronHPKallbachMannSyst::Kallbach(G4double cosTh, G4double anEnergy)
|
||||
{
|
||||
// Kallbach-Mann systematics without normalization.
|
||||
G4double result;
|
||||
G4double theX = A(anEnergy)*cosTh;
|
||||
result = 0.5*(exp( theX)*(1+theCompoundFraction)
|
||||
+exp(-theX)*(1-theCompoundFraction));
|
||||
return result;
|
||||
}
|
||||
|
||||
G4double G4NeutronHPKallbachMannSyst::GetKallbachZero(G4double anEnergy)
|
||||
{
|
||||
G4double result;
|
||||
result = 0.5 * (1./A(anEnergy)) * log((1-theCompoundFraction)/(1+theCompoundFraction));
|
||||
return result;
|
||||
}
|
||||
|
||||
G4double G4NeutronHPKallbachMannSyst::A(G4double anEnergy)
|
||||
{
|
||||
G4double result;
|
||||
G4double C1 = 0.04/MeV;
|
||||
G4double C2 = 1.8E-6/(MeV*MeV*MeV);
|
||||
G4double C3 = 6.7E-7/(MeV*MeV*MeV*MeV);
|
||||
|
||||
G4double epsa = anEnergy*theTargetMass/(theTargetMass+theIncidentMass);
|
||||
G4int Ac = theTargetA+1;
|
||||
G4int Nc = Ac - theTargetZ;
|
||||
G4int AA = theTargetA;
|
||||
G4int ZA = theTargetZ;
|
||||
G4double ea = epsa+SeparationEnergy(Ac, Nc, AA, ZA);
|
||||
G4double Et1 = 130*MeV;
|
||||
G4double R1 = min(ea, Et1);
|
||||
// theProductEnergy is still in CMS!!!
|
||||
G4double epsb = theProductEnergy*(theProductMass+theResidualMass)/theResidualMass;
|
||||
G4int AB = theResidualA;
|
||||
G4int ZB = theResidualZ;
|
||||
G4double eb = epsb+SeparationEnergy(Ac, Nc, AB, ZB );
|
||||
G4double X1 = R1*eb/ea;
|
||||
G4double Et3 = 41*MeV;
|
||||
G4double R3 = min(ea, Et3);
|
||||
G4double X3 = R3*eb/ea;
|
||||
G4double Ma = 1;
|
||||
G4double mb;
|
||||
G4int productA = theTargetA+1-theResidualA;
|
||||
G4int productZ = theTargetZ-theResidualZ;
|
||||
if(productZ==0)
|
||||
{
|
||||
mb = 0.5;
|
||||
}
|
||||
else if(productZ==1)
|
||||
{
|
||||
mb = 1;
|
||||
}
|
||||
else if(productZ==2)
|
||||
{
|
||||
mb = 2;
|
||||
if(productA==3) mb=1;
|
||||
}
|
||||
else
|
||||
{
|
||||
G4Exception("Severe error in the sampling of Kallbach-Mann Systematics");
|
||||
}
|
||||
|
||||
result = C1*X1 + C2*pow(X1, 3.) + C3*Ma*mb*pow(X3, 4.);
|
||||
return result;
|
||||
}
|
||||
|
||||
G4double G4NeutronHPKallbachMannSyst::SeparationEnergy(G4int Ac, G4int Nc, G4int AA, G4int ZA)
|
||||
{
|
||||
G4double result;
|
||||
G4int NA = AA-ZA;
|
||||
G4int Zc = Ac-Nc;
|
||||
result = 15.68*(Ac-AA);
|
||||
result += -28.07*((Nc-Zc)*(Nc-Zc)/Ac - (NA-ZA)*(NA-ZA)/AA);
|
||||
result += -18.56*(pow(Ac, 2./3.) - pow(AA, 2./3.));
|
||||
result += 33.22*((Nc-Zc)*(Nc-Zc)/pow(Ac, 4./3.) - (NA-ZA)*(NA-ZA)/pow(AA, 4./3.));
|
||||
result += -0.717*(Zc*Zc/pow(Ac,1./3.)-ZA*ZA/pow(AA,1./3.));
|
||||
result += 1.211*(Zc*Zc/Ac-ZA*ZA/AA);
|
||||
G4double totalBinding;
|
||||
G4int productA = theTargetA+1-theResidualA;
|
||||
G4int productZ = theTargetZ-theResidualZ;
|
||||
if(productZ==0&&productA==1) totalBinding=0;
|
||||
if(productZ==1&&productA==1) totalBinding=0;
|
||||
if(productZ==1&&productA==2) totalBinding=2.22;
|
||||
if(productZ==1&&productA==3) totalBinding=8.48;
|
||||
if(productZ==2&&productA==3) totalBinding=7.72;
|
||||
if(productZ==2&&productA==4) totalBinding=28.3;
|
||||
result += -totalBinding;
|
||||
result *= MeV;
|
||||
return result;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHPLCFissionFS.hh"
|
||||
|
||||
void G4NeutronHPLCFissionFS::Init (G4double A, G4double Z, G4String & dirName, G4String & aFSType)
|
||||
{
|
||||
G4String aString = "/LC/";
|
||||
G4NeutronHPFissionBaseFS::Init(A, Z, dirName, aString);
|
||||
}
|
||||
|
||||
G4DynamicParticleVector * G4NeutronHPLCFissionFS::ApplyYourself(G4int NNeutrons)
|
||||
{
|
||||
G4DynamicParticleVector * aResult;
|
||||
// G4cout <<"G4NeutronHPLCFissionFS::ApplyYourself +"<<endl;
|
||||
aResult = G4NeutronHPFissionBaseFS::ApplyYourself(NNeutrons);
|
||||
return aResult;
|
||||
}
|
||||
@@ -0,0 +1,329 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHPLabAngularEnergy.hh"
|
||||
#include "G4Gamma.hh"
|
||||
#include "G4Electron.hh"
|
||||
#include "G4Positron.hh"
|
||||
#include "G4Neutron.hh"
|
||||
#include "G4Proton.hh"
|
||||
#include "G4Deuteron.hh"
|
||||
#include "G4Triton.hh"
|
||||
#include "G4He3.hh"
|
||||
#include "G4Alpha.hh"
|
||||
#include "Randomize.hh"
|
||||
|
||||
void G4NeutronHPLabAngularEnergy::Init(ifstream & aDataFile)
|
||||
{
|
||||
aDataFile >> nEnergies;
|
||||
theManager.Init(aDataFile);
|
||||
theEnergies = new G4double[nEnergies];
|
||||
nCosTh = new G4int[nEnergies];
|
||||
theData = new G4NeutronHPVector * [nEnergies];
|
||||
theSecondManager = new G4InterpolationManager [nEnergies];
|
||||
for(G4int i=0; i<nEnergies; i++)
|
||||
{
|
||||
aDataFile >> theEnergies[i];
|
||||
theEnergies[i]*=eV;
|
||||
aDataFile >> nCosTh[i];
|
||||
theSecondManager[i].Init(aDataFile);
|
||||
theData[i] = new G4NeutronHPVector[nCosTh[i]];
|
||||
G4double label;
|
||||
for(G4int ii=0; ii<nCosTh[i]; ii++)
|
||||
{
|
||||
aDataFile >> label;
|
||||
theData[i][ii].SetLabel(label);
|
||||
theData[i][ii].Init(aDataFile, eV);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
G4ReactionProduct * G4NeutronHPLabAngularEnergy::Sample(G4double anEnergy, G4double massCode, G4double mass)
|
||||
{
|
||||
G4ReactionProduct * result = new G4ReactionProduct;
|
||||
G4int Z = massCode/1000;
|
||||
G4int A = massCode-1000*Z;
|
||||
|
||||
if(massCode==0)
|
||||
{
|
||||
result->SetDefinition(G4Gamma::Gamma());
|
||||
}
|
||||
else if(A==0)
|
||||
{
|
||||
result->SetDefinition(G4Electron::Electron());
|
||||
if(Z==1) result->SetDefinition(G4Positron::Positron());
|
||||
}
|
||||
else if(A==1)
|
||||
{
|
||||
result->SetDefinition(G4Neutron::Neutron());
|
||||
if(Z==1) result->SetDefinition(G4Proton::Proton());
|
||||
}
|
||||
else if(A==2)
|
||||
{
|
||||
result->SetDefinition(G4Deuteron::Deuteron());
|
||||
}
|
||||
else if(A==3)
|
||||
{
|
||||
result->SetDefinition(G4Triton::Triton());
|
||||
if(Z==2) result->SetDefinition(G4He3::He3());
|
||||
}
|
||||
else if(A==4)
|
||||
{
|
||||
result->SetDefinition(G4Alpha::Alpha());
|
||||
if(Z!=2) G4Exception("Unknown ion case 1");
|
||||
}
|
||||
else
|
||||
{
|
||||
G4Exception("G4NeutronHPLabAngularEnergy: Unknown ion case 2");
|
||||
}
|
||||
|
||||
// get theta, E
|
||||
G4double cosTh, secEnergy;
|
||||
G4int i, it;
|
||||
// find the energy bin
|
||||
for(i=0; i<nEnergies; i++)
|
||||
{
|
||||
it = i;
|
||||
if(anEnergy<theEnergies[i]) break;
|
||||
}
|
||||
if(it==0 || it == nEnergies-1) // it marks the energy bin
|
||||
{
|
||||
// integrate the prob for each costh, and select theta.
|
||||
G4double * running = new G4double [nCosTh[it]];
|
||||
running[0]=0;
|
||||
for(i=0;i<nCosTh[it]; i++)
|
||||
{
|
||||
if(i!=0) running[i] = running[i-1];
|
||||
running[i]+=theData[it][i].GetIntegral(); // Does interpolated integral.
|
||||
}
|
||||
G4double random = running[nCosTh[it]-1]*G4UniformRand();
|
||||
G4int ith;
|
||||
for(i=0;i<nCosTh[it]; i++)
|
||||
{
|
||||
ith = i;
|
||||
if(random<running[i]) break;
|
||||
}
|
||||
if(ith==0 || ith==nCosTh[it]-1)
|
||||
{
|
||||
cosTh = theData[it][ith].GetLabel();
|
||||
secEnergy = theData[it][ith].Sample();
|
||||
currentMeanEnergy = theData[it][ith].GetMeanX();
|
||||
}
|
||||
else
|
||||
{
|
||||
G4double x1 = theData[it][ith-1].GetIntegral();
|
||||
G4double x2 = theData[it][ith].GetIntegral();
|
||||
G4double x = random;
|
||||
G4double y1 = theData[it][ith-1].GetLabel();
|
||||
G4double y2 = theData[it][ith].GetLabel();
|
||||
cosTh = theInt.Interpolate(theSecondManager[it].GetInverseScheme(ith),
|
||||
x, x1, x2, y1, y2);
|
||||
G4NeutronHPVector theBuff1;
|
||||
theBuff1.SetInterpolationManager(theData[it][ith-1].GetInterpolationManager());
|
||||
G4NeutronHPVector theBuff2;
|
||||
theBuff2.SetInterpolationManager(theData[it][ith].GetInterpolationManager());
|
||||
x1=y1;
|
||||
x2=y2;
|
||||
G4double y, mu;
|
||||
for(i=0;i<theData[it][ith-1].GetVectorLength(); i++)
|
||||
{
|
||||
mu = theData[it][ith-1].GetX(i);
|
||||
y1 = theData[it][ith-1].GetY(i);
|
||||
y2 = theData[it][ith].GetY(mu);
|
||||
y = theInt.Interpolate(theSecondManager[it].GetScheme(ith),
|
||||
cosTh, x1,x2,y1,y2);
|
||||
theBuff1.SetData(i, mu, y);
|
||||
}
|
||||
for(i=0;i<theData[it][ith].GetVectorLength(); i++)
|
||||
{
|
||||
mu = theData[it][ith].GetX(i);
|
||||
y1 = theData[it][ith-1].GetY(mu);
|
||||
y2 = theData[it][ith].GetY(i);
|
||||
y = theInt.Interpolate(theSecondManager[it].GetScheme(ith),
|
||||
cosTh, x1,x2,y1,y2);
|
||||
theBuff2.SetData(i, mu, y);
|
||||
}
|
||||
G4NeutronHPVector theStore;
|
||||
theStore.Merge(&theBuff1, &theBuff2);
|
||||
secEnergy = theStore.Sample();
|
||||
currentMeanEnergy = theStore.GetMeanX();
|
||||
}
|
||||
delete [] running;
|
||||
}
|
||||
else // this is the small big else.
|
||||
{
|
||||
G4double x, x1, x2, y1, y2, y, tmp, E;
|
||||
// integrate the prob for each costh, and select theta.
|
||||
G4NeutronHPVector run1;
|
||||
run1.SetY(0, 0.);
|
||||
for(i=0;i<nCosTh[it-1]; i++)
|
||||
{
|
||||
if(i!=0) run1.SetY(i, run1.GetY(i-1));
|
||||
run1.SetX(i, theData[it-1][i].GetLabel());
|
||||
run1.SetY(i, run1.GetY(i)+theData[it-1][i].GetIntegral());
|
||||
}
|
||||
G4NeutronHPVector run2;
|
||||
run2.SetY(0, 0.);
|
||||
for(i=0;i<nCosTh[it]; i++)
|
||||
{
|
||||
if(i!=0) run2.SetY(i, run2.GetY(i-1));
|
||||
run2.SetX(i, theData[it][i].GetLabel());
|
||||
run2.SetY(i, run2.GetY(i)+theData[it][i].GetIntegral());
|
||||
}
|
||||
// get the distributions for the correct neutron energy
|
||||
x = anEnergy;
|
||||
x1 = theEnergies[it-1];
|
||||
x2 = theEnergies[it];
|
||||
G4NeutronHPVector thBuff1; // to be interpolated as run1.
|
||||
thBuff1.SetInterpolationManager(theSecondManager[it-1]);
|
||||
for(i=0; i<run1.GetVectorLength(); i++)
|
||||
{
|
||||
tmp = run1.GetX(i); //theta
|
||||
y1 = run1.GetY(i); // integral
|
||||
y2 = run2.GetY(tmp);
|
||||
y = theInt.Interpolate(theManager.GetScheme(it), x, x1,x2,y1,y2);
|
||||
thBuff1.SetData(i, tmp, y);
|
||||
}
|
||||
G4NeutronHPVector thBuff2;
|
||||
thBuff2.SetInterpolationManager(theSecondManager[it]);
|
||||
for(i=0; i<run2.GetVectorLength(); i++)
|
||||
{
|
||||
tmp = run2.GetX(i); //theta
|
||||
y1 = run1.GetY(tmp); // integral
|
||||
y2 = run2.GetY(i);
|
||||
y = theInt.Lin(x, x1,x2,y1,y2);
|
||||
thBuff2.SetData(i, tmp, y);
|
||||
}
|
||||
G4NeutronHPVector theThVec;
|
||||
theThVec.Merge(&thBuff1 ,&thBuff2); // takes care of interpolation
|
||||
G4double random = (theThVec.GetY(theThVec.GetVectorLength()-1)
|
||||
-theThVec.GetY(0)) *G4UniformRand();
|
||||
G4int ith;
|
||||
for(i=1;i<theThVec.GetVectorLength(); i++)
|
||||
{
|
||||
ith = i;
|
||||
if(random<theThVec.GetY(i)-theThVec.GetY(0)) break;
|
||||
}
|
||||
{
|
||||
// calculate theta
|
||||
G4double x, x1, x2, y1, y2, y;
|
||||
x = random;
|
||||
x1 = theThVec.GetY(ith-1)-theThVec.GetY(0); // integrals
|
||||
x2 = theThVec.GetY(ith)-theThVec.GetY(0);
|
||||
y1 = theThVec.GetX(ith-1); // cos(theta)
|
||||
y2 = theThVec.GetX(ith);
|
||||
cosTh = theInt.Interpolate(theSecondManager[it].GetScheme(ith),
|
||||
x, x1,x2,y1,y2);
|
||||
}
|
||||
G4int i1, i2;
|
||||
// get the indixes of the vectors close to theta for low energy
|
||||
// first it-1 !!!! i.e. low in energy
|
||||
for(i=0; i<nCosTh[it-1]; i++)
|
||||
{
|
||||
i1 = i;
|
||||
if(cosTh<theData[it-1][i].GetLabel()) break;
|
||||
}
|
||||
// now get the prob at this energy for the right theta value
|
||||
x = cosTh;
|
||||
x1 = theData[it-1][i1-1].GetLabel();
|
||||
x2 = theData[it-1][i1].GetLabel();
|
||||
G4NeutronHPVector theBuff1a;
|
||||
theBuff1a.SetInterpolationManager(theData[it-1][i1-1].GetInterpolationManager());
|
||||
for(i=0;i<theData[it-1][i1-1].GetVectorLength(); i++)
|
||||
{
|
||||
E = theData[it-1][i1-1].GetX(i);
|
||||
y1 = theData[it-1][i1-1].GetY(i);
|
||||
y2 = theData[it-1][i1].GetY(E);
|
||||
y = theInt.Lin(x, x1,x2,y1,y2);
|
||||
theBuff1a.SetData(i, E, y); // wrong E, right theta.
|
||||
}
|
||||
G4NeutronHPVector theBuff2a;
|
||||
theBuff2a.SetInterpolationManager(theData[it-1][i1].GetInterpolationManager());
|
||||
for(i=0;i<theData[it-1][i1].GetVectorLength(); i++)
|
||||
{
|
||||
E = theData[it-1][i1].GetX(i);
|
||||
y1 = theData[it-1][i1-1].GetY(E);
|
||||
y2 = theData[it-1][i1].GetY(i);
|
||||
y = theInt.Lin(x, x1,x2,y1,y2);
|
||||
theBuff2a.SetData(i, E, y); // wrong E, right theta.
|
||||
}
|
||||
G4NeutronHPVector theStore1;
|
||||
theStore1.Merge(&theBuff1a, &theBuff2a); // wrong E, right theta, complete binning
|
||||
|
||||
// get the indixes of the vectors close to theta for high energy
|
||||
// then it !!!! i.e. high in energy
|
||||
for(i=0; i<nCosTh[it]; i++)
|
||||
{
|
||||
i2 = i;
|
||||
if(cosTh<theData[it][i2].GetLabel()) break;
|
||||
} // sonderfaelle mit i1 oder i2 head on fehlen. @@@@@
|
||||
x1 = theData[it][i2-1].GetLabel();
|
||||
x2 = theData[it][i2].GetLabel();
|
||||
G4NeutronHPVector theBuff1b;
|
||||
theBuff1b.SetInterpolationManager(theData[it][i2-1].GetInterpolationManager());
|
||||
for(i=0;i<theData[it][i2-1].GetVectorLength(); i++)
|
||||
{
|
||||
E = theData[it][i2-1].GetX(i);
|
||||
y1 = theData[it][i2-1].GetY(i);
|
||||
y2 = theData[it][i2].GetY(E);
|
||||
y = theInt.Lin(x, x1,x2,y1,y2);
|
||||
theBuff1b.SetData(i, E, y); // wrong E, right theta.
|
||||
}
|
||||
G4NeutronHPVector theBuff2b;
|
||||
theBuff2b.SetInterpolationManager(theData[it][i2].GetInterpolationManager());
|
||||
for(i=0;i<theData[it][i1].GetVectorLength(); i++)
|
||||
{
|
||||
E = theData[it][i1].GetX(i);
|
||||
y1 = theData[it][i1-1].GetY(E);
|
||||
y2 = theData[it][i1].GetY(i);
|
||||
y = theInt.Lin(x, x1,x2,y1,y2);
|
||||
theBuff2b.SetData(i, E, y); // wrong E, right theta.
|
||||
}
|
||||
G4NeutronHPVector theStore2;
|
||||
theStore2.Merge(&theBuff1b, &theBuff2b); // wrong E, right theta, complete binning
|
||||
// now get to the right energy.
|
||||
|
||||
x = anEnergy;
|
||||
x1 = theEnergies[it-1];
|
||||
x2 = theEnergies[it];
|
||||
G4NeutronHPVector theOne1;
|
||||
theOne1.SetInterpolationManager(theStore1.GetInterpolationManager());
|
||||
for(i=0; i<theStore1.GetVectorLength(); i++)
|
||||
{
|
||||
E = theStore1.GetX(i);
|
||||
y1 = theStore1.GetY(i);
|
||||
y2 = theStore2.GetY(E);
|
||||
y = theInt.Interpolate(theManager.GetScheme(it), x, x1,x2,y1,y2);
|
||||
theOne1.SetData(i, E, y); // both correct
|
||||
}
|
||||
G4NeutronHPVector theOne2;
|
||||
theOne2.SetInterpolationManager(theStore2.GetInterpolationManager());
|
||||
for(i=0; i<theStore2.GetVectorLength(); i++)
|
||||
{
|
||||
E = theStore2.GetX(i);
|
||||
y1 = theStore1.GetY(E);
|
||||
y2 = theStore2.GetY(i);
|
||||
y = theInt.Interpolate(theManager.GetScheme(it), x, x1,x2,y1,y2);
|
||||
theOne2.SetData(i, E, y); // both correct
|
||||
}
|
||||
G4NeutronHPVector theOne;
|
||||
theOne.Merge(&theOne1, &theOne2); // both correct, complete binning
|
||||
|
||||
secEnergy = theOne.Sample();
|
||||
currentMeanEnergy = theOne.GetMeanX();
|
||||
}
|
||||
|
||||
// now do random direction in phi, and fill the result.
|
||||
|
||||
result->SetKineticEnergy(secEnergy);
|
||||
|
||||
G4double phi = twopi*G4UniformRand();
|
||||
G4double theta = acos(cosTh);
|
||||
G4double sinth = sin(theta);
|
||||
G4double mtot = result->GetTotalMomentum();
|
||||
G4ThreeVector tempVector(mtot*sinth*cos(phi), mtot*sinth*sin(phi), mtot*cos(theta) );
|
||||
result->SetMomentum(tempVector);
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -0,0 +1,203 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHPLegendreStore.hh"
|
||||
#include "G4NeutronHPVector.hh"
|
||||
#include "G4NeutronHPInterpolator.hh"
|
||||
#include "G4NeutronHPFastLegendre.hh"
|
||||
#include "Randomize.hh"
|
||||
G4double G4NeutronHPLegendreStore::SampleMax (G4double anEnergy)
|
||||
{
|
||||
G4double result;
|
||||
|
||||
G4int i0, i1, i2, i3, i4;
|
||||
G4int low, high;
|
||||
G4NeutronHPFastLegendre theLeg;
|
||||
for (i0=0; i0<nEnergy; i0++)
|
||||
{
|
||||
high = i0;
|
||||
if(theCoeff[i0].GetEnergy()>anEnergy) break;
|
||||
}
|
||||
low = max(0, high-1);
|
||||
G4NeutronHPInterpolator theInt;
|
||||
G4double lim=0.005;
|
||||
G4double x, x1, x2, y1, y2, y;
|
||||
x = anEnergy;
|
||||
x1 = theCoeff[low].GetEnergy();
|
||||
x2 = theCoeff[high].GetEnergy();
|
||||
G4double theNorm = 0;
|
||||
G4double try01=0, try02=0;
|
||||
G4double max1, max2, costh;
|
||||
max1 = 0; max2 = 0;
|
||||
G4int l;
|
||||
for(i0=0; i0<601; i0++)
|
||||
{
|
||||
costh = G4double(i0-300)/300.;
|
||||
try01 = 0;
|
||||
for(l=0; l<theCoeff[low].GetNumberOfPoly() ; l++)
|
||||
{
|
||||
try01 += (2.*l+1)/2.*theCoeff[low].GetCoeff(l)*theLeg.Evaluate(l, costh);
|
||||
}
|
||||
if(try01>max1) max1=try01;
|
||||
try02 = 0;
|
||||
for(l=0; l<theCoeff[high].GetNumberOfPoly() ; l++)
|
||||
{
|
||||
try02 += (2.*l+1)/2.*theCoeff[high].GetCoeff(l)*theLeg.Evaluate(l, costh);
|
||||
}
|
||||
if(try02>max2) max2=try02;
|
||||
}
|
||||
theNorm = theInt.Interpolate(theManager.GetScheme(high), x, x1, x2, max1, max2);
|
||||
|
||||
G4double value, random;
|
||||
G4double v1, v2;
|
||||
do
|
||||
{
|
||||
v1 = 0;
|
||||
v2 = 0;
|
||||
result = 2.*G4UniformRand()-1.;
|
||||
for(l=0; l<theCoeff[low].GetNumberOfPoly() ; l++)
|
||||
{
|
||||
v1 += (2.*l+1)/2.*theCoeff[low].GetCoeff(l)*theLeg.Evaluate(l, result);
|
||||
}
|
||||
for(l=0; l<theCoeff[high].GetNumberOfPoly() ; l++)
|
||||
{
|
||||
v2 += (2.*l+1)/2.*theCoeff[high].GetCoeff(l)*theLeg.Evaluate(l, result);
|
||||
}
|
||||
value = theInt.Interpolate(theManager.GetScheme(high), x, x1, x2, v1, v2);
|
||||
random = G4UniformRand();
|
||||
}
|
||||
while(random>value/theNorm);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
G4double G4NeutronHPLegendreStore::SampleElastic (G4double anEnergy)
|
||||
{
|
||||
G4double result;
|
||||
|
||||
G4int i0, i1, i2, i3, i4;
|
||||
G4int low, high;
|
||||
G4NeutronHPFastLegendre theLeg;
|
||||
for (i0=0; i0<nEnergy; i0++)
|
||||
{
|
||||
high = i0;
|
||||
if(theCoeff[i0].GetEnergy()>anEnergy) break;
|
||||
}
|
||||
low = max(0, high-1);
|
||||
G4NeutronHPInterpolator theInt;
|
||||
G4double lim=0.005;
|
||||
G4double x, x1, x2, y1, y2, y;
|
||||
x = anEnergy;
|
||||
x1 = theCoeff[low].GetEnergy();
|
||||
x2 = theCoeff[high].GetEnergy();
|
||||
G4double theNorm = 0;
|
||||
G4double try01=0, try02=0, try11=0, try12=0;
|
||||
G4double try1, try2;
|
||||
G4int l;
|
||||
for(l=0; l<theCoeff[low].GetNumberOfPoly(); l++)
|
||||
{
|
||||
try01 += (2.*l+1)/2.*theCoeff[low].GetCoeff(l)*theLeg.Evaluate(l, -1.);
|
||||
try11 += (2.*l+1)/2.*theCoeff[low].GetCoeff(l)*theLeg.Evaluate(l, +1.);
|
||||
}
|
||||
for(l=0; l<theCoeff[high].GetNumberOfPoly(); l++)
|
||||
{
|
||||
try02 += (2.*l+1)/2.*theCoeff[high].GetCoeff(l)*theLeg.Evaluate(l, -1.);
|
||||
try12 += (2.*l+1)/2.*theCoeff[high].GetCoeff(l)*theLeg.Evaluate(l, +1.);
|
||||
}
|
||||
try1 = theInt.Interpolate(theManager.GetScheme(high), x, x1, x2, try01, try02);
|
||||
try2 = theInt.Interpolate(theManager.GetScheme(high), x, x1, x2, try11, try12);
|
||||
theNorm = max(try1, try2);
|
||||
|
||||
G4double value, random;
|
||||
G4double v1, v2;
|
||||
do
|
||||
{
|
||||
v1 = 0;
|
||||
v2 = 0;
|
||||
result = 2.*G4UniformRand()-1.;
|
||||
for(l=0; l<theCoeff[low].GetNumberOfPoly() ; l++)
|
||||
{
|
||||
v1 += (2.*l+1)/2.*theCoeff[low].GetCoeff(l)*theLeg.Evaluate(l, result);
|
||||
}
|
||||
for(l=0; l<theCoeff[high].GetNumberOfPoly() ; l++)
|
||||
{
|
||||
v2 += (2.*l+1)/2.*theCoeff[high].GetCoeff(l)*theLeg.Evaluate(l, result);
|
||||
}
|
||||
value = theInt.Interpolate(theManager.GetScheme(high), x, x1, x2, v1, v2);
|
||||
random = G4UniformRand();
|
||||
}
|
||||
while(random>value/theNorm);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
G4double G4NeutronHPLegendreStore::Sample (G4double energy) // still in interpolation; do not use
|
||||
{
|
||||
G4int i0, i1, i2, i3, i4;
|
||||
G4int low, high;
|
||||
// G4cout << "G4NeutronHPLegendreStore::Sample "<<energy<<" "<<energy<<" "<<nEnergy<<endl;
|
||||
for (i0=0; i0<nEnergy; i0++)
|
||||
{
|
||||
// G4cout <<"theCoeff["<<i0<<"].GetEnergy() = "<<theCoeff[i0].GetEnergy()<<endl;
|
||||
high = i0;
|
||||
if(theCoeff[i0].GetEnergy()>energy) break;
|
||||
}
|
||||
low = max(0, high-1);
|
||||
// G4cout << "G4NeutronHPLegendreStore::Sample high, low: "<<high<<", "<<low<<endl;
|
||||
G4NeutronHPVector theBuffer;
|
||||
G4NeutronHPInterpolator theInt;
|
||||
G4double lim=0.005;
|
||||
G4double x1, x2, y1, y2, y;
|
||||
x1 = theCoeff[low].GetEnergy();
|
||||
x2 = theCoeff[high].GetEnergy();
|
||||
// G4cout << "the xes "<<x1<<" "<<x2<<endl;
|
||||
G4double costh=0;
|
||||
for(i0=0; i0<601; i0++)
|
||||
{
|
||||
costh = G4double(i0-300)/300.;
|
||||
y1 = Integrate(low, costh);
|
||||
y2 = Integrate(high, costh);
|
||||
y = theInt.Interpolate(theManager.GetScheme(high), energy, x1, x2, y1, y2);
|
||||
theBuffer.SetData(i0, costh, y);
|
||||
// G4cout << "Integration "<<low<<" "<<costh<<" "<<y1<<" "<<y2<<" "<<y<<endl;
|
||||
}
|
||||
G4double rand = G4UniformRand();
|
||||
G4int it;
|
||||
for (i0=1; i0<601; i0++)
|
||||
{
|
||||
it = i0;
|
||||
if(rand < theBuffer.GetY(i0)/theBuffer.GetY(600)) break;
|
||||
// G4cout <<"sampling now "<<i0<<" "
|
||||
// << theBuffer.GetY(i0)<<" "
|
||||
// << theBuffer.GetY(600)<<" "
|
||||
// << rand<<" "
|
||||
// << theBuffer.GetY(i0)/theBuffer.GetY(600)<<endl;;
|
||||
}
|
||||
if(it==601) it=600;
|
||||
// G4cout << "G4NeutronHPLegendreStore::Sample it "<<rand<<" "<<it<<endl;
|
||||
G4double norm = theBuffer.GetY(600);
|
||||
if(norm==0) return -DBL_MAX;
|
||||
x1 = theBuffer.GetY(it)/norm;
|
||||
x2 = theBuffer.GetY(it-1)/norm;
|
||||
y1 = theBuffer.GetX(it);
|
||||
y2 = theBuffer.GetX(it-1);
|
||||
// G4cout << "G4NeutronHPLegendreStore::Sample x y "<<x1<<" "<<y1<<" "<<x2<<" "<<y2<<endl;
|
||||
return theInt.Interpolate(theManager.GetScheme(high), rand, x1, x2, y1, y2);
|
||||
}
|
||||
|
||||
G4double G4NeutronHPLegendreStore::Integrate(G4int k, G4double costh) // still in interpolation; not used anymore
|
||||
{
|
||||
G4double result=0;
|
||||
G4NeutronHPFastLegendre theLeg;
|
||||
// G4cout <<"the COEFFS "<<k<<" ";
|
||||
// G4cout <<theCoeff[k].GetNumberOfPoly()<<" ";
|
||||
for(G4int l=0; l<theCoeff[k].GetNumberOfPoly() ; l++)
|
||||
{
|
||||
result += theCoeff[k].GetCoeff(l)*theLeg.Integrate(l, costh);
|
||||
// G4cout << theCoeff[k].GetCoeff(l)<<" ";
|
||||
}
|
||||
// G4cout <<endl;
|
||||
return result;
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHPLevel.hh"
|
||||
#include "G4NeutronHPGamma.hh"
|
||||
|
||||
G4NeutronHPLevel::~G4NeutronHPLevel()
|
||||
{
|
||||
if(theGammas != NULL)
|
||||
{
|
||||
for(G4int i=0; i<nGammas; i++) delete theGammas[i];
|
||||
}
|
||||
delete [] theGammas;
|
||||
}
|
||||
|
||||
void G4NeutronHPLevel::SetNumberOfGammas(G4int aGammas)
|
||||
{
|
||||
nGammas = aGammas;
|
||||
if(theGammas != NULL)
|
||||
{
|
||||
for(G4int i=0; i<nGammas; i++) delete theGammas[i];
|
||||
}
|
||||
delete [] theGammas;
|
||||
theGammas = new G4NeutronHPGamma * [nGammas];
|
||||
}
|
||||
|
||||
void G4NeutronHPLevel::SetGamma(G4int i, G4NeutronHPGamma * aGamma)
|
||||
{
|
||||
theGammas[i] = aGamma;
|
||||
SetLevelEnergy(aGamma->GetLevelEnergy());
|
||||
}
|
||||
|
||||
G4double G4NeutronHPLevel::GetGammaEnergy(G4int i)
|
||||
{
|
||||
return theGammas[i]->GetGammaEnergy();
|
||||
}
|
||||
|
||||
G4DynamicParticleVector * G4NeutronHPLevel::GetDecayGammas()
|
||||
{
|
||||
G4DynamicParticleVector * theResult;
|
||||
G4double sum = 0;
|
||||
G4double * running = new G4double[nGammas];
|
||||
running[0] = 0;
|
||||
G4int i;
|
||||
for(i=0; i<nGammas; i++)
|
||||
{
|
||||
if(i!=0) running[i]=running[i-1];
|
||||
running[i]+=theGammas[i]->GetWeight();
|
||||
}
|
||||
sum = running[nGammas-1];
|
||||
G4int it;
|
||||
G4double random = G4UniformRand();
|
||||
for(i=0; i<nGammas; i++)
|
||||
{
|
||||
it = i;
|
||||
if(random<running[i]/sum) break;
|
||||
}
|
||||
delete [] running;
|
||||
theResult = theGammas[it]->GetDecayGammas();
|
||||
return theResult;
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHPList.hh"
|
||||
|
||||
void G4NeutronHPList::Check(G4int i)
|
||||
{
|
||||
if(i<0)
|
||||
{
|
||||
G4int dummy; cin >> dummy;
|
||||
}
|
||||
if(i>nEntries) G4Exception("Skipped some index numbers in G4NeutronHPList");
|
||||
if(i==nPoints)
|
||||
{
|
||||
nPoints += 50;
|
||||
G4double * buff = new G4double[nPoints];
|
||||
for (G4int j=0; j<nEntries; j++) buff[j] = theData[j];
|
||||
delete [] theData;
|
||||
theData = buff;
|
||||
}
|
||||
if(i==nEntries) nEntries++;
|
||||
}
|
||||
|
||||
void G4NeutronHPList::Init(ifstream & aDataFile, G4int nPar, G4double unit)
|
||||
{
|
||||
G4int i;
|
||||
G4double y;
|
||||
for (i=0; i<nPar; i++)
|
||||
{
|
||||
aDataFile >> y;
|
||||
SetValue(i,y*unit);
|
||||
}
|
||||
}
|
||||
|
||||
void G4NeutronHPList::Init(ifstream & aDataFile, G4double unit)
|
||||
{
|
||||
G4int total, i;
|
||||
aDataFile >> total;
|
||||
G4double y;
|
||||
for (i=0;i<total;i++)
|
||||
{
|
||||
aDataFile >>y;
|
||||
SetValue(i,y*unit);
|
||||
}
|
||||
}
|
||||
|
||||
G4double G4NeutronHPList::GetValue(G4int i)
|
||||
{
|
||||
// G4cout << "TestList "<<i<<" "<<nEntries<<endl;
|
||||
if(nEntries<0)
|
||||
{
|
||||
// G4cout <<nPoints<<" "<<nEntries<<" "<<theData<<endl;
|
||||
// for(G4int ii=0; ii<2; ii++) G4cout << theData[ii]<<" ";
|
||||
// G4cout << endl;
|
||||
}
|
||||
if (i<0) i=0;
|
||||
if(i>=GetListLength()) i=GetListLength()-1;
|
||||
return theData[i];
|
||||
}
|
||||
|
||||
@@ -0,0 +1,146 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
#include "G4NeutronHPMadlandNixSpectrum.hh"
|
||||
|
||||
G4double G4NeutronHPMadlandNixSpectrum::Madland(G4double aSecEnergy, G4double tm)
|
||||
{
|
||||
G4double result;
|
||||
G4double energy = aSecEnergy/eV;
|
||||
G4double EF;
|
||||
|
||||
EF = theAvarageKineticPerNucleonForLightFragments/eV;
|
||||
G4double lightU1 = sqrt(energy)-sqrt(EF);
|
||||
lightU1 *= lightU1/tm;
|
||||
G4double lightU2 = sqrt(energy)+sqrt(EF);
|
||||
lightU2 *= lightU2/tm;
|
||||
G4double lightTerm=0;
|
||||
if(theAvarageKineticPerNucleonForLightFragments>1*eV)
|
||||
{
|
||||
lightTerm = pow(lightU2, 1.5)*E1(lightU2);
|
||||
lightTerm -= pow(lightU1, 1.5)*E1(lightU1);
|
||||
lightTerm += Gamma15(lightU2)-Gamma15(lightU1);
|
||||
lightTerm /= 3.*sqrt(tm*EF);
|
||||
}
|
||||
|
||||
EF = theAvarageKineticPerNucleonForHeavyFragments/eV;
|
||||
G4double heavyU1 = sqrt(energy)-sqrt(EF);
|
||||
heavyU1 *= heavyU1/tm;
|
||||
G4double heavyU2 = sqrt(energy)+sqrt(EF);
|
||||
heavyU2 *= heavyU2/tm;
|
||||
G4double heavyTerm=0 ;
|
||||
if(theAvarageKineticPerNucleonForHeavyFragments> 1*eV)
|
||||
{
|
||||
heavyTerm = pow(heavyU2, 1.5)*E1(heavyU2);
|
||||
heavyTerm -= pow(heavyU1, 1.5)*E1(heavyU1);
|
||||
heavyTerm += Gamma15(heavyU2)-Gamma15(heavyU1);
|
||||
heavyTerm /= 3.*sqrt(tm*EF);
|
||||
}
|
||||
|
||||
result = 0.5*(lightTerm+heavyTerm);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
G4double G4NeutronHPMadlandNixSpectrum::Sample(G4double anEnergy)
|
||||
{
|
||||
G4bool Done = false;
|
||||
G4double tm = theMaxTemp.GetY(anEnergy);
|
||||
G4double last=0, buff, current = 100*MeV;
|
||||
G4double precision = 0.001;
|
||||
G4double newValue = 0., oldValue=0., diff=0.;
|
||||
G4double random = G4UniformRand();
|
||||
|
||||
do
|
||||
{
|
||||
oldValue = newValue;
|
||||
newValue = FissionIntegral(tm, current);
|
||||
if(newValue < random)
|
||||
{
|
||||
buff = current;
|
||||
current+=abs(current-last)/2.;
|
||||
last = buff;
|
||||
if(current>190*MeV) G4Exception("Madland-Nix Spectrum has not converged in sampling");
|
||||
}
|
||||
else
|
||||
{
|
||||
buff = current;
|
||||
current-=abs(current-last)/2.;
|
||||
last = buff;
|
||||
}
|
||||
}
|
||||
while (abs(oldValue-newValue)>precision*newValue);
|
||||
return current;
|
||||
}
|
||||
|
||||
G4double G4NeutronHPMadlandNixSpectrum::
|
||||
GIntegral(G4double tm, G4double anEnergy, G4double aMean)
|
||||
{
|
||||
if(aMean<1*eV) return 0;
|
||||
G4double b = anEnergy/eV;
|
||||
G4double sb = sqrt(b);
|
||||
G4double EF = aMean/eV;
|
||||
|
||||
G4double alpha = sqrt(tm);
|
||||
G4double beta = sqrt(EF);
|
||||
G4double A = EF/tm;
|
||||
G4double B = (sb+beta)*(sb+beta)/tm;
|
||||
G4double Ap = A;
|
||||
G4double Bp = (sb-beta)*(sb-beta)/tm;
|
||||
|
||||
G4double result;
|
||||
G4double alpha2 = alpha*alpha;
|
||||
G4double alphabeta = alpha*beta;
|
||||
if(b<EF)
|
||||
{
|
||||
result =
|
||||
(
|
||||
(0.4*alpha2*pow(B,2.5) - 0.5*alphabeta*B*B)*E1(B) -
|
||||
(0.4*alpha2*pow(A,2.5) - 0.5*alphabeta*A*A)*E1(A)
|
||||
)
|
||||
-
|
||||
(
|
||||
(0.4*alpha2*pow(Bp,2.5) + 0.5*alphabeta*Bp*Bp)*E1(Bp) -
|
||||
(0.4*alpha2*pow(Ap,2.5) + 0.5*alphabeta*Ap*Ap)*E1(Ap)
|
||||
)
|
||||
+
|
||||
(
|
||||
(alpha2*B-2*alphabeta*sqrt(B))*Gamma15(B) -
|
||||
(alpha2*A-2*alphabeta*sqrt(A))*Gamma15(A)
|
||||
)
|
||||
-
|
||||
(
|
||||
(alpha2*Bp-2*alphabeta*sqrt(Bp))*Gamma15(Bp) -
|
||||
(alpha2*Ap-2*alphabeta*sqrt(Ap))*Gamma15(Ap)
|
||||
)
|
||||
- 0.6*alpha2*(Gamma25(B) - Gamma25(A) - Gamma25(Bp) + Gamma25(Ap))
|
||||
- 1.5*alphabeta*(exp(-B)*(1+B) - exp(-A)*(1+A) + exp(-Bp)*(1+Bp) + exp(-Ap)*(1+Ap)) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
result =
|
||||
(
|
||||
(0.4*alpha2*pow(B,2.5) - 0.5*alphabeta*B*B)*E1(B) -
|
||||
(0.4*alpha2*pow(A,2.5) - 0.5*alphabeta*A*A)*E1(A)
|
||||
);
|
||||
result -=
|
||||
(
|
||||
(0.4*alpha2*pow(Bp,2.5) + 0.5*alphabeta*Bp*Bp)*E1(Bp) -
|
||||
(0.4*alpha2*pow(Ap,2.5) + 0.5*alphabeta*Ap*Ap)*E1(Ap)
|
||||
);
|
||||
result +=
|
||||
(
|
||||
(alpha2*B-2*alphabeta*sqrt(B))*Gamma15(B) -
|
||||
(alpha2*A-2*alphabeta*sqrt(A))*Gamma15(A)
|
||||
);
|
||||
result -=
|
||||
(
|
||||
(alpha2*Bp+2*alphabeta*sqrt(Bp))*Gamma15(Bp) -
|
||||
(alpha2*Ap+2*alphabeta*sqrt(Ap))*Gamma15(Ap)
|
||||
);
|
||||
result -= 0.6*alpha2*(Gamma25(B) - Gamma25(A) - Gamma25(Bp) + Gamma25(Ap));
|
||||
result -= 1.5*alphabeta*(exp(-B)*(1+B) - exp(-A)*(1+A) + exp(-Bp)*(1+Bp) + exp(-Ap)*(1+Ap) - 2.) ;
|
||||
}
|
||||
result = result / (3.*sqrt(tm*EF));
|
||||
return result;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHPN2AInelasticFS.hh"
|
||||
#include "G4Nucleus.hh"
|
||||
#include "G4Alpha.hh"
|
||||
|
||||
G4ParticleChange * G4NeutronHPN2AInelasticFS::ApplyYourself(const G4Track & theTrack)
|
||||
{
|
||||
// these are the particle types in the final state
|
||||
|
||||
G4ParticleDefinition * theDefs[3];
|
||||
theDefs[0] = G4Neutron::Neutron();
|
||||
theDefs[1] = G4Alpha::Alpha();
|
||||
theDefs[2] = G4Alpha::Alpha();
|
||||
|
||||
// fill the final state
|
||||
G4NeutronHPInelasticBaseFS::BaseApply(theTrack, theDefs, 3);
|
||||
|
||||
// return the result
|
||||
return &theResult;
|
||||
}
|
||||
|
||||
void G4NeutronHPN2AInelasticFS::
|
||||
Init (G4double A, G4double Z, G4String & dirName, G4String & aFSType)
|
||||
{
|
||||
G4NeutronHPInelasticBaseFS::Init(A, Z, dirName, aFSType);
|
||||
G4double ResidualA = A-8;
|
||||
G4double ResidualZ = Z-4;
|
||||
G4NeutronHPInelasticBaseFS::InitGammas(ResidualA, ResidualZ);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHPN2PInelasticFS.hh"
|
||||
#include "G4Nucleus.hh"
|
||||
#include "G4Proton.hh"
|
||||
|
||||
G4ParticleChange * G4NeutronHPN2PInelasticFS::ApplyYourself(const G4Track & theTrack)
|
||||
{
|
||||
// these are the particle types in the final state
|
||||
|
||||
G4ParticleDefinition * theDefs[3];
|
||||
theDefs[0] = G4Neutron::Neutron();
|
||||
theDefs[1] = G4Proton::Proton();
|
||||
theDefs[2] = G4Proton::Proton();
|
||||
|
||||
// fill the final state
|
||||
G4NeutronHPInelasticBaseFS::BaseApply(theTrack, theDefs, 3);
|
||||
|
||||
// return the result
|
||||
return &theResult;
|
||||
}
|
||||
|
||||
void G4NeutronHPN2PInelasticFS::
|
||||
Init (G4double A, G4double Z, G4String & dirName, G4String & aFSType)
|
||||
{
|
||||
G4NeutronHPInelasticBaseFS::Init(A, Z, dirName, aFSType);
|
||||
G4double ResidualA = A-2;
|
||||
G4double ResidualZ = Z-2;
|
||||
G4NeutronHPInelasticBaseFS::InitGammas(ResidualA, ResidualZ);
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHPN3AInelasticFS.hh"
|
||||
#include "G4Nucleus.hh"
|
||||
#include "G4Alpha.hh"
|
||||
|
||||
G4ParticleChange * G4NeutronHPN3AInelasticFS::ApplyYourself(const G4Track & theTrack)
|
||||
{
|
||||
// these are the particle types in the final state
|
||||
|
||||
G4ParticleDefinition * theDefs[4];
|
||||
theDefs[0] = G4Neutron::Neutron();
|
||||
theDefs[1] = G4Alpha::Alpha();
|
||||
theDefs[2] = G4Alpha::Alpha();
|
||||
theDefs[3] = G4Alpha::Alpha();
|
||||
|
||||
// fill the final state
|
||||
G4NeutronHPInelasticBaseFS::BaseApply(theTrack, theDefs, 4);
|
||||
|
||||
// return the result
|
||||
return &theResult;
|
||||
}
|
||||
|
||||
void G4NeutronHPN3AInelasticFS::
|
||||
Init (G4double A, G4double Z, G4String & dirName, G4String & aFSType)
|
||||
{
|
||||
G4NeutronHPInelasticBaseFS::Init(A, Z, dirName, aFSType);
|
||||
G4double ResidualA = A-12;
|
||||
G4double ResidualZ = Z-6;
|
||||
G4NeutronHPInelasticBaseFS::InitGammas(ResidualA, ResidualZ);
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHPNAInelasticFS.hh"
|
||||
#include "G4Nucleus.hh"
|
||||
#include "G4Alpha.hh"
|
||||
|
||||
G4ParticleChange * G4NeutronHPNAInelasticFS::ApplyYourself(const G4Track & theTrack)
|
||||
{
|
||||
// these are the particle types in the final state
|
||||
|
||||
G4ParticleDefinition * theDefs[2];
|
||||
theDefs[0] = G4Neutron::Neutron();
|
||||
theDefs[1] = G4Alpha::Alpha();
|
||||
|
||||
// fill the final state
|
||||
G4NeutronHPInelasticBaseFS::BaseApply(theTrack, theDefs, 2);
|
||||
|
||||
// return the result
|
||||
return &theResult;
|
||||
}
|
||||
|
||||
void G4NeutronHPNAInelasticFS::
|
||||
Init (G4double A, G4double Z, G4String & dirName, G4String & aFSType)
|
||||
{
|
||||
G4NeutronHPInelasticBaseFS::Init(A, Z, dirName, aFSType);
|
||||
G4double ResidualA = A-4;
|
||||
G4double ResidualZ = Z-2;
|
||||
G4NeutronHPInelasticBaseFS::InitGammas(ResidualA, ResidualZ);
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
// 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: G4NeutronHPNBodyPhaseSpace.cc,v 2.2 1998/11/21 10:34:10 hpw Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
#include "G4NeutronHPNBodyPhaseSpace.hh"
|
||||
#include "G4Gamma.hh"
|
||||
#include "G4Electron.hh"
|
||||
#include "G4Positron.hh"
|
||||
#include "G4Neutron.hh"
|
||||
#include "G4Proton.hh"
|
||||
#include "G4Deuteron.hh"
|
||||
#include "G4Triton.hh"
|
||||
#include "G4He3.hh"
|
||||
#include "G4Alpha.hh"
|
||||
#include "Randomize.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
G4ReactionProduct * G4NeutronHPNBodyPhaseSpace::Sample(G4double anEnergy, G4double massCode, G4double mass)
|
||||
{
|
||||
G4ReactionProduct * result = new G4ReactionProduct;
|
||||
G4int Z = massCode/1000;
|
||||
G4int A = massCode-1000*Z;
|
||||
|
||||
if(massCode==0)
|
||||
{
|
||||
result->SetDefinition(G4Gamma::Gamma());
|
||||
}
|
||||
else if(A==0)
|
||||
{
|
||||
result->SetDefinition(G4Electron::Electron());
|
||||
if(Z==1) result->SetDefinition(G4Positron::Positron());
|
||||
}
|
||||
else if(A==1)
|
||||
{
|
||||
result->SetDefinition(G4Neutron::Neutron());
|
||||
if(Z==1) result->SetDefinition(G4Proton::Proton());
|
||||
}
|
||||
else if(A==2)
|
||||
{
|
||||
result->SetDefinition(G4Deuteron::Deuteron());
|
||||
}
|
||||
else if(A==3)
|
||||
{
|
||||
result->SetDefinition(G4Triton::Triton());
|
||||
if(Z==2) result->SetDefinition(G4He3::He3());
|
||||
}
|
||||
else if(A==4)
|
||||
{
|
||||
result->SetDefinition(G4Alpha::Alpha());
|
||||
if(Z!=2) G4Exception("Unknown ion case 1");
|
||||
}
|
||||
else
|
||||
{
|
||||
G4Exception("G4NeutronHPNBodyPhaseSpace: Unknown ion case 2");
|
||||
}
|
||||
|
||||
// Get the energy from phase-space distribution
|
||||
// in CMS
|
||||
// P = Cn*sqrt(E')*(Emax-E')**(3*n/2-4)
|
||||
G4double maxE = GetEmax(anEnergy, result->GetMass());
|
||||
G4double energy;
|
||||
G4double max;
|
||||
G4double tMass = GetTarget()->GetMass();
|
||||
G4double pMass = GetNeutron()->GetMass();
|
||||
if(theTotalCount<=3)
|
||||
{
|
||||
max = maxE/2.;
|
||||
}
|
||||
else if(theTotalCount==4)
|
||||
{
|
||||
max = maxE/5.;
|
||||
}
|
||||
else if(theTotalCount==5)
|
||||
{
|
||||
max = maxE/8.;
|
||||
}
|
||||
else
|
||||
{
|
||||
G4Exception("NeutronHP Phase-space distribution cannot cope with this number of particles");
|
||||
}
|
||||
G4double testit;
|
||||
G4double rand0 = Prob(max, maxE, theTotalCount);
|
||||
G4double rand;
|
||||
|
||||
do
|
||||
{
|
||||
rand = rand0*G4UniformRand();
|
||||
energy = maxE*G4UniformRand();
|
||||
testit = Prob(energy, maxE, theTotalCount);
|
||||
}
|
||||
while(rand > testit);
|
||||
result->SetKineticEnergy(energy);
|
||||
|
||||
// now do random direction
|
||||
G4double cosTh = 2.*G4UniformRand()-1.;
|
||||
G4double phi = twopi*G4UniformRand();
|
||||
G4double theta = acos(cosTh);
|
||||
G4double sinth = sin(theta);
|
||||
G4double mtot = result->GetTotalMomentum();
|
||||
G4ThreeVector tempVector(mtot*sinth*cos(phi), mtot*sinth*sin(phi), mtot*cos(theta) );
|
||||
result->SetMomentum(tempVector);
|
||||
G4ReactionProduct aCMS = *GetTarget()+*GetNeutron();
|
||||
result->Lorentz(*result, -1.*aCMS);
|
||||
return result;
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHPND2AInelasticFS.hh"
|
||||
#include "G4Nucleus.hh"
|
||||
#include "G4Deuteron.hh"
|
||||
#include "G4Alpha.hh"
|
||||
|
||||
G4ParticleChange * G4NeutronHPND2AInelasticFS::ApplyYourself(const G4Track & theTrack)
|
||||
{
|
||||
// these are the particle types in the final state
|
||||
|
||||
G4ParticleDefinition * theDefs[4];
|
||||
theDefs[0] = G4Neutron::Neutron();
|
||||
theDefs[1] = G4Deuteron::Deuteron();
|
||||
theDefs[2] = G4Alpha::Alpha();
|
||||
theDefs[3] = G4Alpha::Alpha();
|
||||
|
||||
// fill the final state
|
||||
G4NeutronHPInelasticBaseFS::BaseApply(theTrack, theDefs, 4);
|
||||
|
||||
// return the result
|
||||
return &theResult;
|
||||
}
|
||||
|
||||
void G4NeutronHPND2AInelasticFS::
|
||||
Init (G4double A, G4double Z, G4String & dirName, G4String & aFSType)
|
||||
{
|
||||
G4NeutronHPInelasticBaseFS::Init(A, Z, dirName, aFSType);
|
||||
G4double ResidualA = A-10;
|
||||
G4double ResidualZ = Z-5;
|
||||
G4NeutronHPInelasticBaseFS::InitGammas(ResidualA, ResidualZ);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHPNDInelasticFS.hh"
|
||||
#include "G4Nucleus.hh"
|
||||
#include "G4Deuteron.hh"
|
||||
|
||||
G4ParticleChange * G4NeutronHPNDInelasticFS::ApplyYourself(const G4Track & theTrack)
|
||||
{
|
||||
// these are the particle types in the final state
|
||||
|
||||
G4ParticleDefinition * theDefs[2];
|
||||
theDefs[0] = G4Neutron::Neutron();
|
||||
theDefs[1] = G4Deuteron::Deuteron();
|
||||
|
||||
// fill the final state
|
||||
G4NeutronHPInelasticBaseFS::BaseApply(theTrack, theDefs, 2);
|
||||
|
||||
// return the result
|
||||
return &theResult;
|
||||
}
|
||||
|
||||
void G4NeutronHPNDInelasticFS::
|
||||
Init (G4double A, G4double Z, G4String & dirName, G4String & aFSType)
|
||||
{
|
||||
G4NeutronHPInelasticBaseFS::Init(A, Z, dirName, aFSType);
|
||||
G4double ResidualA = A-2;
|
||||
G4double ResidualZ = Z-1;
|
||||
G4NeutronHPInelasticBaseFS::InitGammas(ResidualA, ResidualZ);
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHPNHe3InelasticFS.hh"
|
||||
#include "G4Nucleus.hh"
|
||||
#include "G4He3.hh"
|
||||
|
||||
G4ParticleChange * G4NeutronHPNHe3InelasticFS::ApplyYourself(const G4Track & theTrack)
|
||||
{
|
||||
// these are the particle types in the final state
|
||||
|
||||
G4ParticleDefinition * theDefs[2];
|
||||
theDefs[0] = G4Neutron::Neutron();
|
||||
theDefs[1] = G4He3::He3();
|
||||
|
||||
// fill the final state
|
||||
G4NeutronHPInelasticBaseFS::BaseApply(theTrack, theDefs, 2);
|
||||
|
||||
// return the result
|
||||
return &theResult;
|
||||
}
|
||||
|
||||
void G4NeutronHPNHe3InelasticFS::
|
||||
Init (G4double A, G4double Z, G4String & dirName, G4String & aFSType)
|
||||
{
|
||||
G4NeutronHPInelasticBaseFS::Init(A, Z, dirName, aFSType);
|
||||
G4double ResidualA = A-3;
|
||||
G4double ResidualZ = Z-2;
|
||||
G4NeutronHPInelasticBaseFS::InitGammas(ResidualA, ResidualZ);
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHPNInelasticFS.hh"
|
||||
#include "G4Nucleus.hh"
|
||||
#include "G4Neutron.hh"
|
||||
#include "G4Proton.hh"
|
||||
#include "G4Gamma.hh"
|
||||
#include "G4ios.hh"
|
||||
#include <fstream.h>
|
||||
#ifdef WIN32
|
||||
#include <strstrea.h>
|
||||
#else
|
||||
#include <strstream.h>
|
||||
#endif
|
||||
|
||||
void G4NeutronHPNInelasticFS::Init (G4double A, G4double Z, G4String & dirName, G4String & aFSType)
|
||||
{
|
||||
G4NeutronHPInelasticCompFS::Init(A, Z, dirName, aFSType);
|
||||
G4double ResidualA = A;
|
||||
G4double ResidualZ = Z;
|
||||
G4NeutronHPInelasticCompFS::InitGammas(ResidualA, ResidualZ);
|
||||
}
|
||||
|
||||
G4ParticleChange * G4NeutronHPNInelasticFS::ApplyYourself(const G4Track & theTrack)
|
||||
{
|
||||
|
||||
// do the final state
|
||||
G4NeutronHPInelasticCompFS::CompositeApply(theTrack, G4Neutron::Neutron());
|
||||
|
||||
// return the result
|
||||
return &theResult;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHPNPAInelasticFS.hh"
|
||||
#include "G4Nucleus.hh"
|
||||
#include "G4Alpha.hh"
|
||||
#include "G4Proton.hh"
|
||||
|
||||
G4ParticleChange * G4NeutronHPNPAInelasticFS::ApplyYourself(const G4Track & theTrack)
|
||||
{
|
||||
// these are the particle types in the final state
|
||||
|
||||
G4ParticleDefinition * theDefs[3];
|
||||
theDefs[0] = G4Neutron::Neutron();
|
||||
theDefs[1] = G4Proton::Proton();
|
||||
theDefs[2] = G4Alpha::Alpha();
|
||||
|
||||
// fill the final state
|
||||
G4NeutronHPInelasticBaseFS::BaseApply(theTrack, theDefs, 3);
|
||||
|
||||
// return the result
|
||||
return &theResult;
|
||||
}
|
||||
|
||||
void G4NeutronHPNPAInelasticFS::
|
||||
Init (G4double A, G4double Z, G4String & dirName, G4String & aFSType)
|
||||
{
|
||||
G4NeutronHPInelasticBaseFS::Init(A, Z, dirName, aFSType);
|
||||
G4double ResidualA = A-5;
|
||||
G4double ResidualZ = Z-3;
|
||||
G4NeutronHPInelasticBaseFS::InitGammas(ResidualA, ResidualZ);
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHPNPInelasticFS.hh"
|
||||
#include "G4Nucleus.hh"
|
||||
#include "G4Proton.hh"
|
||||
|
||||
G4ParticleChange * G4NeutronHPNPInelasticFS::ApplyYourself(const G4Track & theTrack)
|
||||
{
|
||||
// these are the particle types in the final state
|
||||
|
||||
G4ParticleDefinition * theDefs[2];
|
||||
theDefs[0] = G4Neutron::Neutron();
|
||||
theDefs[1] = G4Proton::Proton();
|
||||
|
||||
// fill the final state
|
||||
G4NeutronHPInelasticBaseFS::BaseApply(theTrack, theDefs, 2);
|
||||
|
||||
// return the result
|
||||
return &theResult;
|
||||
}
|
||||
|
||||
void G4NeutronHPNPInelasticFS::
|
||||
Init (G4double A, G4double Z, G4String & dirName, G4String & aFSType)
|
||||
{
|
||||
G4NeutronHPInelasticBaseFS::Init(A, Z, dirName, aFSType);
|
||||
G4double ResidualA = A-1;
|
||||
G4double ResidualZ = Z-1;
|
||||
G4NeutronHPInelasticBaseFS::InitGammas(ResidualA, ResidualZ);
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHPNT2AInelasticFS.hh"
|
||||
#include "G4Nucleus.hh"
|
||||
#include "G4Alpha.hh"
|
||||
#include "G4Triton.hh"
|
||||
|
||||
G4ParticleChange * G4NeutronHPNT2AInelasticFS::ApplyYourself(const G4Track & theTrack)
|
||||
{
|
||||
// these are the particle types in the final state
|
||||
|
||||
G4ParticleDefinition * theDefs[4];
|
||||
theDefs[0] = G4Neutron::Neutron();
|
||||
theDefs[1] = G4Triton::Triton();
|
||||
theDefs[2] = G4Alpha::Alpha();
|
||||
theDefs[3] = G4Alpha::Alpha();
|
||||
|
||||
// fill the final state
|
||||
G4NeutronHPInelasticBaseFS::BaseApply(theTrack, theDefs, 4);
|
||||
|
||||
// return the result
|
||||
return &theResult;
|
||||
}
|
||||
|
||||
void G4NeutronHPNT2AInelasticFS::
|
||||
Init (G4double A, G4double Z, G4String & dirName, G4String & aFSType)
|
||||
{
|
||||
G4NeutronHPInelasticBaseFS::Init(A, Z, dirName, aFSType);
|
||||
G4double ResidualA = A-11;
|
||||
G4double ResidualZ = Z-5;
|
||||
G4NeutronHPInelasticBaseFS::InitGammas(ResidualA, ResidualZ);
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHPNTInelasticFS.hh"
|
||||
#include "G4Nucleus.hh"
|
||||
#include "G4Triton.hh"
|
||||
|
||||
G4ParticleChange * G4NeutronHPNTInelasticFS::ApplyYourself(const G4Track & theTrack)
|
||||
{
|
||||
// these are the particle types in the final state
|
||||
|
||||
G4ParticleDefinition * theDefs[2];
|
||||
theDefs[0] = G4Neutron::Neutron();
|
||||
theDefs[1] = G4Triton::Triton();
|
||||
|
||||
// fill the final state
|
||||
G4NeutronHPInelasticBaseFS::BaseApply(theTrack, theDefs, 2);
|
||||
|
||||
// return the result
|
||||
return &theResult;
|
||||
}
|
||||
|
||||
void G4NeutronHPNTInelasticFS::
|
||||
Init (G4double A, G4double Z, G4String & dirName, G4String & aFSType)
|
||||
{
|
||||
G4NeutronHPInelasticBaseFS::Init(A, Z, dirName, aFSType);
|
||||
G4double ResidualA = A-3;
|
||||
G4double ResidualZ = Z-1;
|
||||
G4NeutronHPInelasticBaseFS::InitGammas(ResidualA, ResidualZ);
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHPNXInelasticFS.hh"
|
||||
#include "G4Nucleus.hh"
|
||||
#include "G4Alpha.hh"
|
||||
|
||||
G4ParticleChange * G4NeutronHPNXInelasticFS::ApplyYourself(const G4Track & theTrack)
|
||||
{
|
||||
// these are the particle types in the final state
|
||||
|
||||
G4ParticleDefinition * theDefs[2];
|
||||
theDefs[0] = G4Neutron::Neutron();
|
||||
|
||||
// fill the final state
|
||||
G4NeutronHPInelasticBaseFS::BaseApply(theTrack, theDefs, 1);
|
||||
|
||||
// return the result
|
||||
return &theResult;
|
||||
}
|
||||
|
||||
void G4NeutronHPNXInelasticFS::
|
||||
Init (G4double A, G4double Z, G4String & dirName, G4String & aFSType)
|
||||
{
|
||||
G4NeutronHPInelasticBaseFS::Init(A, Z, dirName, aFSType);
|
||||
G4double ResidualA = A-5; // wrong, to be improves @@@
|
||||
G4double ResidualZ = Z-2; // dito @@@
|
||||
G4NeutronHPInelasticBaseFS::InitGammas(ResidualA, ResidualZ);
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHPNames.hh"
|
||||
#include "G4SandiaTable.hh"
|
||||
|
||||
const G4String G4NeutronHPNames::theString[99] = {"Hydrogen", "Helium",
|
||||
"Lithium", "Berylium", "Boron", "Carbon", "Nitrogen", "Oxygen", "Fluorine",
|
||||
"Neon", "Sodium", "Magnesium", "Aluminum", "Silicon", "Phosphorous",
|
||||
"Sulfur", "Chlorine", "Argon", "Potassium", "Calcium", "Scandium",
|
||||
"Titanium", "Vanadium", "Chromium", "Manganese", "Iron", "Cobalt", "Nickel",
|
||||
"Copper", "Zinc", "Gallium", "Germanium", "Arsenic", "Selenium", "Bromine",
|
||||
"Krypton", "Rubidium", "Strontium", "Yttrium", "Zirconium", "Niobium",
|
||||
"Molybdenum", "Technetium", "Ruthenium", "Rhodium", "Palladium", "Silver",
|
||||
"Cadmium", "Indium", "Tin", "Antimony", "Tellurium", "Iodine", "Xenon",
|
||||
"Cesium", "Barium", "Lanthanum", "Cerium", "Praseodymium", "Neodymium",
|
||||
"Promethium", "Samarium", "Europium", "Gadolinium", "Terbium", "Dysprosium",
|
||||
"Holmium", "Erbium", "Thulium", "Ytterbium", "Lutetium", "Hafnium",
|
||||
"Tantalum", "Tungsten", "Rhenium", "Osmium", "Iridium", "Platinium", "Gold",
|
||||
"Mercury", "Thallium", "Lead", "Bismuth", "Polonium", "Astatine", "Radon",
|
||||
"Francium", "Radium", "Actinium ", "Thorium", "Protactinium", "Uranium",
|
||||
"Neptunium", "Plutonium", "Americium", "Curium", "Berkelium", "Californium",
|
||||
"Einsteinium"};
|
||||
|
||||
|
||||
G4NeutronHPDataUsed G4NeutronHPNames::GetName(G4int A, G4int Z, G4String base, G4String rest, G4bool & aFlag)
|
||||
{
|
||||
G4NeutronHPDataUsed result;
|
||||
aFlag = true;
|
||||
// G4cout << "Names::GetName entered"<<endl;
|
||||
G4int myA = A;
|
||||
G4int myZ = Z;
|
||||
G4String * theName = NULL;
|
||||
G4String theFileName("");
|
||||
G4int offA = 0, offZ = 0, inc = 1;
|
||||
|
||||
ifstream check;
|
||||
G4bool first = true;
|
||||
// G4cout << "entered GetName!!!"<<endl;
|
||||
do
|
||||
{
|
||||
aFlag = true;
|
||||
char the1[100] = {""};
|
||||
ostrstream ost1(the1, 100, ios::out);
|
||||
ost1 <<base<<"/"<<"CrossSection/"<<myZ<<"_"<<myA<<"_"<<theString[myZ-1];
|
||||
G4String * biff = new G4String(the1); // delete here as theName
|
||||
if(theName!=NULL) delete theName;
|
||||
theName = biff;
|
||||
result.SetName(*theName);
|
||||
result.SetA(myA);
|
||||
result.SetZ(myZ);
|
||||
check.open(*theName);
|
||||
if(!(check))
|
||||
{
|
||||
aFlag = false;
|
||||
if(first)
|
||||
{
|
||||
aFlag = true;
|
||||
first = false;
|
||||
char the1[100] = {""};
|
||||
ostrstream ost1(the1, 100, ios::out);
|
||||
ost1 <<base<<"/"<<"CrossSection/"<<myZ<<"_"<<"nat"<<"_"<<theString[myZ-1];
|
||||
biff = new G4String(the1); // delete here as theName
|
||||
if(theName!=NULL) delete theName;
|
||||
theName = biff;
|
||||
result.SetName(*theName);
|
||||
G4double natA = myZ/G4SandiaTable::GetZtoA(myZ);
|
||||
result.SetA(natA);
|
||||
result.SetZ(myZ);
|
||||
check.open(*theName);
|
||||
if (!check)
|
||||
{
|
||||
aFlag = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
char the1[100] = {""};
|
||||
ostrstream ost1(the1, 100, ios::out);
|
||||
ost1 <<base<<"/"<<rest<<myZ<<"_"<<"nat"<<"_"<<theString[myZ-1];
|
||||
biff = new G4String(the1); // delete here as theName
|
||||
if(theName!=NULL) delete theName;
|
||||
theName = biff;
|
||||
result.SetName(*theName);
|
||||
G4double natA = myZ/G4SandiaTable::GetZtoA(myZ);
|
||||
result.SetA(natA);
|
||||
result.SetZ(myZ);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
char the1[100] = {""};
|
||||
ostrstream ost1(the1, 100, ios::out);
|
||||
ost1 <<base<<"/"<<rest<<myZ<<"_"<<myA<<"_"<<theString[myZ-1];
|
||||
biff = new G4String(the1); // delete here as theName
|
||||
if(theName!=NULL) delete theName;
|
||||
theName = biff;
|
||||
result.SetName(*theName);
|
||||
result.SetA(myA);
|
||||
result.SetZ(myZ);
|
||||
}
|
||||
if (abs(myZ-Z)>5||myZ==0||myA==0)
|
||||
if(inc>0)
|
||||
{
|
||||
inc*= -1;
|
||||
myZ = Z;
|
||||
myA = A;
|
||||
}else{
|
||||
G4cout <<"G4NeutronHPNames: Sorry, this material does not come near to any data."<<endl;
|
||||
G4cout <<"G4NeutronHPNames: Please make sure NeutronHPCrossSections points to the" << endl;
|
||||
G4cout <<" directory, the neutron scattering data are located in." << endl;
|
||||
G4cout << "G4NeutronHPNames: The material was: A="<<A<<", Z="<<Z<<endl;
|
||||
G4Exception("In case the data sets are at present not available in the neutron data library, please contact Hans-Peter.Wellisch@cern.ch");
|
||||
delete theName;
|
||||
theFileName = "";
|
||||
return result;
|
||||
}
|
||||
if (abs(myA-A)>5)
|
||||
{
|
||||
first = true;
|
||||
myA = A;
|
||||
myZ+=inc;
|
||||
}else{
|
||||
myA+=inc;
|
||||
}
|
||||
}
|
||||
while(!(check));
|
||||
// G4cout << "Names::GetName: last theName proposal = "<< *theName <<" "<<A<<" "<<Z<<endl;
|
||||
// G4cout << "File-name: "<<*theName<<endl;
|
||||
delete theName;
|
||||
return result;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHPPAInelasticFS.hh"
|
||||
#include "G4Nucleus.hh"
|
||||
#include "G4Alpha.hh"
|
||||
#include "G4Proton.hh"
|
||||
|
||||
G4ParticleChange * G4NeutronHPPAInelasticFS::ApplyYourself(const G4Track & theTrack)
|
||||
{
|
||||
// these are the particle types in the final state
|
||||
|
||||
G4ParticleDefinition * theDefs[2];
|
||||
theDefs[0] = G4Proton::Proton();
|
||||
theDefs[1] = G4Alpha::Alpha();
|
||||
|
||||
// fill the final state
|
||||
G4NeutronHPInelasticBaseFS::BaseApply(theTrack, theDefs, 2);
|
||||
|
||||
// return the result
|
||||
return &theResult;
|
||||
}
|
||||
|
||||
void G4NeutronHPPAInelasticFS::
|
||||
Init (G4double A, G4double Z, G4String & dirName, G4String & aFSType)
|
||||
{
|
||||
G4NeutronHPInelasticBaseFS::Init(A, Z, dirName, aFSType);
|
||||
G4double ResidualA = A-4;
|
||||
G4double ResidualZ = Z-3;
|
||||
G4NeutronHPInelasticBaseFS::InitGammas(ResidualA, ResidualZ);
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHPPDInelasticFS.hh"
|
||||
#include "G4Nucleus.hh"
|
||||
#include "G4Proton.hh"
|
||||
#include "G4Deuteron.hh"
|
||||
|
||||
G4ParticleChange * G4NeutronHPPDInelasticFS::ApplyYourself(const G4Track & theTrack)
|
||||
{
|
||||
// these are the particle types in the final state
|
||||
|
||||
G4ParticleDefinition * theDefs[2];
|
||||
theDefs[0] = G4Proton::Proton();
|
||||
theDefs[1] = G4Deuteron::Deuteron();
|
||||
|
||||
// fill the final state
|
||||
G4NeutronHPInelasticBaseFS::BaseApply(theTrack, theDefs, 2);
|
||||
|
||||
// return the result
|
||||
return &theResult;
|
||||
}
|
||||
|
||||
void G4NeutronHPPDInelasticFS::
|
||||
Init (G4double A, G4double Z, G4String & dirName, G4String & aFSType)
|
||||
{
|
||||
G4NeutronHPInelasticBaseFS::Init(A, Z, dirName, aFSType);
|
||||
G4double ResidualA = A-2;
|
||||
G4double ResidualZ = Z-2;
|
||||
G4NeutronHPInelasticBaseFS::InitGammas(ResidualA, ResidualZ);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHPPInelasticFS.hh"
|
||||
#include "G4Nucleus.hh"
|
||||
#include "G4Proton.hh"
|
||||
|
||||
void G4NeutronHPPInelasticFS::Init (G4double A, G4double Z, G4String & dirName, G4String & aFSType)
|
||||
{
|
||||
G4NeutronHPInelasticCompFS::Init(A, Z, dirName, aFSType);
|
||||
G4double ResidualA = A;
|
||||
G4double ResidualZ = Z-1;
|
||||
G4NeutronHPInelasticCompFS::InitGammas(ResidualA, ResidualZ);
|
||||
}
|
||||
|
||||
G4ParticleChange * G4NeutronHPPInelasticFS::ApplyYourself(const G4Track & theTrack)
|
||||
{
|
||||
|
||||
// do the final state
|
||||
G4NeutronHPInelasticCompFS::CompositeApply(theTrack, G4Proton::Proton());
|
||||
|
||||
// return the result
|
||||
return &theResult;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHPPTInelasticFS.hh"
|
||||
#include "G4Nucleus.hh"
|
||||
#include "G4Triton.hh"
|
||||
|
||||
G4ParticleChange * G4NeutronHPPTInelasticFS::ApplyYourself(const G4Track & theTrack)
|
||||
{
|
||||
// these are the particle types in the final state
|
||||
|
||||
G4ParticleDefinition * theDefs[2];
|
||||
theDefs[0] = G4Proton::Proton();
|
||||
theDefs[1] = G4Triton::Triton();
|
||||
|
||||
// fill the final state
|
||||
G4NeutronHPInelasticBaseFS::BaseApply(theTrack, theDefs, 2);
|
||||
|
||||
// return the result
|
||||
return &theResult;
|
||||
}
|
||||
|
||||
void G4NeutronHPPTInelasticFS::
|
||||
Init (G4double A, G4double Z, G4String & dirName, G4String & aFSType)
|
||||
{
|
||||
G4NeutronHPInelasticBaseFS::Init(A, Z, dirName, aFSType);
|
||||
G4double ResidualA = A-3;
|
||||
G4double ResidualZ = Z-2;
|
||||
G4NeutronHPInelasticBaseFS::InitGammas(ResidualA, ResidualZ);
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
#include "G4NeutronHPPartial.hh"
|
||||
#include "G4NeutronHPInterpolator.hh"
|
||||
#include "Randomize.hh"
|
||||
|
||||
G4NeutronHPVector * G4NeutronHPPartial::GetY(G4double e1)
|
||||
{
|
||||
G4NeutronHPVector * aBuffer = new G4NeutronHPVector();
|
||||
G4int i;
|
||||
if(nData==1)
|
||||
{
|
||||
for(i=0; i<data[0].GetVectorLength(); i++)
|
||||
{
|
||||
aBuffer->SetInterpolationManager(data[0].GetInterpolationManager());
|
||||
aBuffer->SetData(i , data[0].GetX(i), data[0].GetY(i));
|
||||
}
|
||||
return aBuffer;
|
||||
}
|
||||
for (i=0; i<nData; i++)
|
||||
{
|
||||
if(X[i]>e1) break;
|
||||
}
|
||||
if(i==nData) i--;
|
||||
G4double x1,x2,y1,y2,y, off, slope;
|
||||
G4int i1=0, ib=0;
|
||||
G4double E1 = X[i-1];
|
||||
G4double E2 = X[i];
|
||||
for(G4int ii=0; ii<data[i].GetVectorLength(); ii++)
|
||||
{
|
||||
x1 = data[i-1].GetX(min(i1, data[i-1].GetVectorLength()-1));
|
||||
x2 = data[i].GetX(ii);
|
||||
if(x1<x2&&i1<data[i-1].GetVectorLength())
|
||||
{
|
||||
y1 = data[i-1].GetY(i1);
|
||||
y2 = data[i].GetY(x1);
|
||||
if(E2-E1!=0)
|
||||
{
|
||||
y = theInt.Interpolate(theManager.GetScheme(i), e1, E1, E2, y1, y2);
|
||||
}
|
||||
else
|
||||
{
|
||||
y = 0.5*(y1+y2);
|
||||
}
|
||||
aBuffer->SetData(ib, x1, y);
|
||||
aBuffer->SetScheme(ib++, data[i-1].GetScheme(i1));
|
||||
i1++;
|
||||
if(x2-x1>0.001*x1)
|
||||
{
|
||||
ii--;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
y1 = data[i-1].GetY(x2);
|
||||
y2 = data[i].GetY(ii);
|
||||
if(E2-E1!=0)
|
||||
{
|
||||
y = theInt.Interpolate(theManager.GetScheme(i), e1, E1, E2, y1, y2);
|
||||
}
|
||||
else
|
||||
{
|
||||
y = 0.5*(y1+y2);
|
||||
}
|
||||
aBuffer->SetData(ib, x2, y);
|
||||
aBuffer->SetScheme(ib++, data[i].GetScheme(ii));
|
||||
if(x1-x2<0.001*x2) i1++;
|
||||
}
|
||||
}
|
||||
return aBuffer;
|
||||
}
|
||||
|
||||
G4double G4NeutronHPPartial::Sample(G4double x)
|
||||
{
|
||||
G4double result=0;
|
||||
G4int i;
|
||||
for (i=0; i<nData; i++)
|
||||
{
|
||||
if(x<X[i]) break;
|
||||
}
|
||||
G4NeutronHPVector theBuff;
|
||||
if(i==0)
|
||||
{
|
||||
theBuff.SetInterpolationManager(data[0].GetInterpolationManager());
|
||||
for(G4int ii=0;ii<GetNEntries(0);i++)
|
||||
{
|
||||
theBuff.SetX(ii, GetX(0,ii));
|
||||
theBuff.SetY(ii, GetY(0,ii));
|
||||
}
|
||||
}
|
||||
else if(i==nData-1)
|
||||
{
|
||||
for(i=0;i<GetNEntries(nData-1);i++)
|
||||
{
|
||||
theBuff.SetX(i, GetX(nData-1,i));
|
||||
theBuff.SetY(i, GetY(nData-1,i));
|
||||
theBuff.SetInterpolationManager(data[nData-1].GetInterpolationManager());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
G4int low = i-1;
|
||||
G4int high = low+1;
|
||||
G4double x1,x2,y1,y2;
|
||||
G4int i1=0, i2=0, ii=0;
|
||||
x1 = X[low];
|
||||
x2 = X[high];
|
||||
while(i1<GetNEntries(low)||i2<GetNEntries(high))
|
||||
{
|
||||
if( (GetX(low,i1)<GetX(high,i2) && i1<GetNEntries(low))
|
||||
||(i2==GetNEntries(high)) )
|
||||
{
|
||||
theBuff.SetX(ii, GetX(low,i1));
|
||||
y1 = GetY(low,i1);
|
||||
y2 = GetY(high, GetX(low,i1)); //prob at ident theta
|
||||
theBuff.SetY(ii, theInt.Interpolate(theManager.GetScheme(high),
|
||||
x, x1, x2, y1, y2)); //energy interpol
|
||||
theBuff.SetScheme(ii, data[low].GetScheme(i1));
|
||||
if(abs(GetX(low,i1)-GetX(high,i2))<0.001) i2++;
|
||||
i1++;
|
||||
ii++;
|
||||
}
|
||||
else
|
||||
{
|
||||
theBuff.SetX(ii, GetX(high,i2));
|
||||
y1 = GetY(high,i2);
|
||||
y2 = GetY(low, GetX(high,i2)); //prob at ident theta
|
||||
theBuff.SetY(ii, theInt.Interpolate(theManager.GetScheme(high),
|
||||
x, x1, x2, y1, y2)); //energy interpol
|
||||
theBuff.SetScheme(ii, data[high].GetScheme(i2));
|
||||
if(abs(GetX(low,i1)-GetX(high,i2))<0.001) i1++;
|
||||
i2++;
|
||||
ii++;
|
||||
}
|
||||
}
|
||||
}
|
||||
//buff is full, now sample.
|
||||
return theBuff.Sample();
|
||||
}
|
||||
@@ -0,0 +1,427 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
//
|
||||
// there is a lot of unused (and undebugged) code in this file. Kept for the moment just in case. @@
|
||||
|
||||
#include "G4NeutronHPPhotonDist.hh"
|
||||
#include "G4NeutronHPLegendreStore.hh"
|
||||
#include "G4Electron.hh"
|
||||
|
||||
G4bool G4NeutronHPPhotonDist::InitMean(ifstream & aDataFile)
|
||||
{
|
||||
G4bool result = true;
|
||||
if(aDataFile >> repFlag)
|
||||
{
|
||||
aDataFile >> targetMass;
|
||||
G4int d1=0;
|
||||
G4double e=0, y=0, z=0;
|
||||
if(repFlag==1)
|
||||
{
|
||||
// multiplicities
|
||||
aDataFile >> nDiscrete;
|
||||
disType = new G4int[nDiscrete];
|
||||
energy = new G4double[nDiscrete];
|
||||
actualMult = new G4int[nDiscrete];
|
||||
theYield = new G4NeutronHPVector[nDiscrete];
|
||||
for (G4int i=0; i<nDiscrete; i++)
|
||||
{
|
||||
aDataFile >> disType[i]>>energy[i];
|
||||
energy[i]*=eV;
|
||||
theYield[i].Init(aDataFile, eV);
|
||||
}
|
||||
}
|
||||
else if(repFlag == 2)
|
||||
{
|
||||
aDataFile >> theInternalConversionFlag;
|
||||
aDataFile >> theBaseEnergy;
|
||||
theBaseEnergy*=eV;
|
||||
aDataFile >> theInternalConversionFlag;
|
||||
aDataFile >> nGammaEnergies;
|
||||
theLevelEnergies = new G4double[nGammaEnergies];
|
||||
theTransitionProbabilities = new G4double[nGammaEnergies];
|
||||
if(theInternalConversionFlag == 2) thePhotonTransitionFraction = new G4double[nGammaEnergies];
|
||||
for(G4int ii=0; ii<nGammaEnergies; ii++)
|
||||
{
|
||||
if(theInternalConversionFlag == 1)
|
||||
{
|
||||
aDataFile >> theLevelEnergies[ii] >> theTransitionProbabilities[ii];
|
||||
theLevelEnergies[ii]*=eV;
|
||||
}
|
||||
else if(theInternalConversionFlag == 2)
|
||||
{
|
||||
aDataFile >> theLevelEnergies[ii] >> theTransitionProbabilities[ii] >> thePhotonTransitionFraction[ii];
|
||||
theLevelEnergies[ii]*=eV;
|
||||
}
|
||||
else
|
||||
{
|
||||
G4Exception("G4NeutronHPPhotonDist: Unknown conversion flag");
|
||||
}
|
||||
}
|
||||
// Note, that this is equivalent to using the 'Gamma' classes.
|
||||
// G4Exception("G4NeutronHPPhotonDist: Transition probability array not sampled for the moment.");
|
||||
}
|
||||
else
|
||||
{
|
||||
G4cout << "Data representation in G4NeutronHPPhotonDist: "<<repFlag<<endl;
|
||||
G4Exception("G4NeutronHPPhotonDist: This data representation is not implemented.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void G4NeutronHPPhotonDist::InitAngular(ifstream & aDataFile)
|
||||
{
|
||||
G4int i, ii;
|
||||
//angular distributions
|
||||
aDataFile >> isoFlag;
|
||||
if (isoFlag != 1)
|
||||
{
|
||||
aDataFile >> tabulationType >> nDiscrete2 >> nIso;
|
||||
theShells = new G4double[nDiscrete2];
|
||||
theGammas = new G4double[nDiscrete2];
|
||||
for (i=0; i< nIso; i++) // isotropic photons
|
||||
{
|
||||
aDataFile >> theGammas[i] >> theShells[i];
|
||||
theGammas[i]*=eV;
|
||||
theShells[i]*=eV;
|
||||
}
|
||||
G4double eNeu, coeff;
|
||||
G4int nPoly, nProb;
|
||||
nNeu = new G4int [nDiscrete2-nIso];
|
||||
if(tabulationType==1)theLegendre=new G4NeutronHPLegendreTable *[nDiscrete2-nIso];
|
||||
if(tabulationType==2)theAngular =new G4NeutronHPAngularP *[nDiscrete2-nIso];
|
||||
for(i=nIso; i< nDiscrete2; i++)
|
||||
{
|
||||
if(tabulationType==1)
|
||||
{
|
||||
aDataFile >> theGammas[i] >> theShells[i] >> nNeu[i-nIso];
|
||||
theGammas[i]*=eV;
|
||||
theShells[i]*=eV;
|
||||
theLegendre[i-nIso]=new G4NeutronHPLegendreTable[nNeu[i-nIso]];
|
||||
theLegendreManager.Init(aDataFile);
|
||||
for (ii=0; ii<nNeu[i-nIso]; ii++)
|
||||
{
|
||||
theLegendre[i-nIso][ii].Init(aDataFile);
|
||||
}
|
||||
}
|
||||
else if(tabulationType==2)
|
||||
{
|
||||
aDataFile >> theGammas[i] >> theShells[i] >> nNeu[i-nIso];
|
||||
theGammas[i]*=eV;
|
||||
theShells[i]*=eV;
|
||||
theAngular[i-nIso]=new G4NeutronHPAngularP[nNeu[i-nIso]];
|
||||
for (ii=0; ii<nNeu[i-nIso]; ii++)
|
||||
{
|
||||
theAngular[i-nIso][ii].Init(aDataFile);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
G4cout << "tabulation type: tabulationType"<<endl;
|
||||
G4Exception("cannot deal with this tabulation type for angular distributions.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void G4NeutronHPPhotonDist::InitEnergies(ifstream & aDataFile)
|
||||
{
|
||||
G4int i, energyDistributionsNeeded = 0;
|
||||
for (i=0; i<nDiscrete; i++)
|
||||
{
|
||||
if( disType[i]==1) energyDistributionsNeeded =1;
|
||||
}
|
||||
if(!energyDistributionsNeeded) return;
|
||||
aDataFile >> nPartials;
|
||||
distribution = new G4int[nPartials];
|
||||
probs = new G4NeutronHPVector[nPartials];
|
||||
partials = new G4NeutronHPPartial * [nPartials];
|
||||
G4int nen;
|
||||
G4int dummy;
|
||||
for (i=0; i<nPartials; i++)
|
||||
{
|
||||
aDataFile >> dummy;
|
||||
probs[i].Init(aDataFile, eV);
|
||||
aDataFile >> nen;
|
||||
partials[i] = new G4NeutronHPPartial(nen);
|
||||
partials[i]->InitInterpolation(aDataFile);
|
||||
partials[i]->Init(aDataFile);
|
||||
}
|
||||
}
|
||||
|
||||
void G4NeutronHPPhotonDist::InitPartials(ifstream & aDataFile)
|
||||
{
|
||||
aDataFile >> nDiscrete >> targetMass;
|
||||
if(nDiscrete != 1)
|
||||
{
|
||||
theTotalXsec.Init(aDataFile, eV);
|
||||
}
|
||||
G4int i;
|
||||
theGammas = new G4double[nDiscrete];
|
||||
theShells = new G4double[nDiscrete];
|
||||
isPrimary = new G4int[nDiscrete];
|
||||
disType = new G4int[nDiscrete];
|
||||
thePartialXsec = new G4NeutronHPVector[nDiscrete];
|
||||
for(i=0; i<nDiscrete; i++)
|
||||
{
|
||||
aDataFile>>theGammas[i]>>theShells[i]>>isPrimary[i]>>disType[i];
|
||||
theGammas[i]*=eV;
|
||||
theShells[i]*=eV;
|
||||
thePartialXsec[i].Init(aDataFile, eV);
|
||||
}
|
||||
}
|
||||
|
||||
G4ReactionProductVector * G4NeutronHPPhotonDist::GetPhotons(G4double anEnergy)
|
||||
{
|
||||
// the partial cross-section case is not in this yet. @@@@
|
||||
G4int i, ii, iii;
|
||||
G4int nSecondaries = 0;
|
||||
G4ReactionProductVector * thePhotons = new G4ReactionProductVector;
|
||||
if(repFlag==1)
|
||||
{
|
||||
G4double current=0;
|
||||
for(i=0; i<nDiscrete; i++)
|
||||
{
|
||||
current = theYield[i].GetY(anEnergy);
|
||||
actualMult[i] = RandPoisson::shoot(current); // max cut-off still missing @@@
|
||||
if(nDiscrete==1&¤t<1.0001)
|
||||
{
|
||||
actualMult[i] = current;
|
||||
if(current<1)
|
||||
{
|
||||
actualMult[i] = 0;
|
||||
if(G4UniformRand()<current) actualMult[i] = 1;
|
||||
}
|
||||
}
|
||||
nSecondaries += actualMult[i];
|
||||
}
|
||||
for(i=0;i<nSecondaries;i++)
|
||||
{
|
||||
G4ReactionProduct * theOne = new G4ReactionProduct;
|
||||
theOne->SetDefinition(G4Gamma::Gamma());
|
||||
thePhotons->insert(theOne);
|
||||
}
|
||||
G4int count=0;
|
||||
for(i=0; i<nDiscrete; i++)
|
||||
{
|
||||
for(ii=0; ii< actualMult[i]; ii++)
|
||||
{
|
||||
if(disType[i]==1) // continuum
|
||||
{
|
||||
G4double econt=0, sum=0, run=0;
|
||||
for(iii=0; iii<nPartials; iii++) sum+=probs[iii].GetY(anEnergy);
|
||||
G4double random = G4UniformRand();
|
||||
G4int theP = 0;
|
||||
for(iii=0; iii<nPartials; iii++)
|
||||
{
|
||||
run+=probs[iii].GetY(anEnergy);
|
||||
theP = iii;
|
||||
if(random<run/sum) break;
|
||||
}
|
||||
if(theP==nPartials) theP=nPartials-1; // das sortiert J aus.
|
||||
sum=0;
|
||||
G4NeutronHPVector * temp;
|
||||
temp = partials[theP]->GetY(anEnergy); //@@@ look at, seems fishy
|
||||
G4double eGamm = temp->Sample();
|
||||
thePhotons->at(count)->SetKineticEnergy(eGamm);
|
||||
delete temp;
|
||||
}
|
||||
else // discrete
|
||||
{
|
||||
thePhotons->at(count)->SetKineticEnergy(energy[i]);
|
||||
}
|
||||
count++;
|
||||
if(count > nSecondaries) G4Exception("G4NeutronHPPhotonDist::GetPhotons inconsistancy");
|
||||
}
|
||||
}
|
||||
// now do the angular distributions...
|
||||
G4double count1=0;
|
||||
if( isoFlag == 1)
|
||||
{
|
||||
for (i=0; i< nSecondaries; i++)
|
||||
{
|
||||
G4double costheta = 2.*G4UniformRand()-1;
|
||||
G4double theta = acos(costheta);
|
||||
G4double phi = twopi*G4UniformRand();
|
||||
G4double sinth = sin(theta);
|
||||
G4double en = thePhotons->at(i)->GetTotalEnergy();
|
||||
G4ThreeVector temp(en*sinth*cos(phi), en*sinth*sin(phi), en*cos(theta) );
|
||||
thePhotons->at(i)->SetMomentum( temp ) ;
|
||||
// G4cout << "Isotropic distribution in PhotonDist"<<temp<<endl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for(i=0; i<nSecondaries; i++)
|
||||
{
|
||||
G4double currentEnergy = thePhotons->at(i)->GetTotalEnergy();
|
||||
for(ii=0; ii<nDiscrete2; ii++)
|
||||
{
|
||||
if (abs(currentEnergy-theGammas[ii])<0.1*keV) break;
|
||||
}
|
||||
if(ii==nDiscrete2) ii--; // fix for what seems an (file12 vs file 14) inconsistancy found in the ENDF 7N14 data. @@
|
||||
if(ii<nIso)
|
||||
{
|
||||
// isotropic distribution
|
||||
G4double theta = pi*G4UniformRand();
|
||||
G4double phi = twopi*G4UniformRand();
|
||||
G4double sinth = sin(theta);
|
||||
G4double en = thePhotons->at(i)->GetTotalEnergy();
|
||||
G4ThreeVector tempVector(en*sinth*cos(phi), en*sinth*sin(phi), en*cos(theta) );
|
||||
thePhotons->at(i)->SetMomentum( tempVector ) ;
|
||||
}
|
||||
else if(tabulationType==1)
|
||||
{
|
||||
// legendre polynomials
|
||||
G4double rand = G4UniformRand();
|
||||
G4int it;
|
||||
for (iii=0; iii<nNeu[ii-nIso]; iii++) // find the neutron energy
|
||||
{
|
||||
it = iii;
|
||||
if(theLegendre[ii-nIso][iii].GetEnergy()>anEnergy)
|
||||
break;
|
||||
}
|
||||
G4NeutronHPLegendreStore aStore(2);
|
||||
aStore.SetCoeff(1, &(theLegendre[ii-nIso][it]));
|
||||
aStore.SetCoeff(0, &(theLegendre[ii-nIso][it-1]));
|
||||
G4double cosTh = aStore.SampleMax(anEnergy);
|
||||
G4double theta = acos(cosTh);
|
||||
G4double phi = twopi*G4UniformRand();
|
||||
G4double sinth = sin(theta);
|
||||
G4double en = thePhotons->at(i)->GetTotalEnergy();
|
||||
G4ThreeVector tempVector(en*sinth*cos(phi), en*sinth*sin(phi), en*cos(theta) );
|
||||
thePhotons->at(i)->SetMomentum( tempVector ) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
// tabulation of probabilities.
|
||||
G4int it;
|
||||
for (iii=0; iii<nNeu[ii-nIso]; iii++) // find the neutron energy
|
||||
{
|
||||
it = iii;
|
||||
if(theAngular[ii-nIso][iii].GetEnergy()>anEnergy)
|
||||
break;
|
||||
}
|
||||
G4double costh = theAngular[ii-nIso][it].GetCosTh(); // no interpolation yet @@
|
||||
G4double theta = acos(costh);
|
||||
G4double phi = twopi*G4UniformRand();
|
||||
G4double sinth = sin(theta);
|
||||
G4double en = thePhotons->at(i)->GetTotalEnergy();
|
||||
G4ThreeVector tmpVector(en*sinth*cos(phi), en*sinth*sin(phi), en*costh );
|
||||
thePhotons->at(i)->SetMomentum( tmpVector ) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(repFlag == 2)
|
||||
{
|
||||
G4double * running = new G4double[nGammaEnergies];
|
||||
running[0]=theTransitionProbabilities[0];
|
||||
G4int i;
|
||||
for(i=1; i<nGammaEnergies; i++)
|
||||
{
|
||||
running[i]+=theTransitionProbabilities[i];
|
||||
}
|
||||
G4double random = G4UniformRand();
|
||||
G4int it=0;
|
||||
for(i=0; i<nGammaEnergies; i++)
|
||||
{
|
||||
it = i;
|
||||
if(random < running[i]/running[nGammaEnergies-1]) break;
|
||||
}
|
||||
delete [] running;
|
||||
G4double totalEnergy = theBaseEnergy - theLevelEnergies[it];
|
||||
G4ReactionProduct * theOne = new G4ReactionProduct;
|
||||
theOne->SetDefinition(G4Gamma::Gamma());
|
||||
random = G4UniformRand();
|
||||
if(theInternalConversionFlag==2 && random>thePhotonTransitionFraction[it])
|
||||
{
|
||||
theOne->SetDefinition(G4Electron::Electron());
|
||||
}
|
||||
theOne->SetTotalEnergy(totalEnergy);
|
||||
G4double count1=0;
|
||||
if( isoFlag == 1)
|
||||
{
|
||||
G4double costheta = 2.*G4UniformRand()-1;
|
||||
G4double theta = acos(costheta);
|
||||
G4double phi = twopi*G4UniformRand();
|
||||
G4double sinth = sin(theta);
|
||||
G4double en = theOne->GetTotalEnergy();
|
||||
G4ThreeVector temp(en*sinth*cos(phi), en*sinth*sin(phi), en*cos(theta) );
|
||||
theOne->SetMomentum( temp ) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
G4double currentEnergy = theOne->GetTotalEnergy();
|
||||
for(ii=0; ii<nDiscrete2; ii++)
|
||||
{
|
||||
if (abs(currentEnergy-theGammas[ii])<0.1*keV) break;
|
||||
}
|
||||
if(ii==nDiscrete2) ii--; // fix for what seems an (file12 vs file 14) inconsistancy found in the ENDF 7N14 data. @@
|
||||
if(ii<nIso)
|
||||
{
|
||||
// isotropic distribution
|
||||
G4double theta = pi*G4UniformRand();
|
||||
G4double phi = twopi*G4UniformRand();
|
||||
G4double sinth = sin(theta);
|
||||
G4double en = theOne->GetTotalEnergy();
|
||||
G4ThreeVector tempVector(en*sinth*cos(phi), en*sinth*sin(phi), en*cos(theta) );
|
||||
theOne->SetMomentum( tempVector ) ;
|
||||
}
|
||||
else if(tabulationType==1)
|
||||
{
|
||||
// legendre polynomials
|
||||
G4double rand = G4UniformRand();
|
||||
G4int it;
|
||||
for (iii=0; iii<nNeu[ii-nIso]; iii++) // find the neutron energy
|
||||
{
|
||||
it = iii;
|
||||
if(theLegendre[ii-nIso][iii].GetEnergy()>anEnergy)
|
||||
break;
|
||||
}
|
||||
G4NeutronHPLegendreStore aStore(2);
|
||||
aStore.SetCoeff(1, &(theLegendre[ii-nIso][it]));
|
||||
aStore.SetCoeff(0, &(theLegendre[ii-nIso][it-1]));
|
||||
G4double cosTh = aStore.SampleMax(anEnergy);
|
||||
G4double theta = acos(cosTh);
|
||||
G4double phi = twopi*G4UniformRand();
|
||||
G4double sinth = sin(theta);
|
||||
G4double en = theOne->GetTotalEnergy();
|
||||
G4ThreeVector tempVector(en*sinth*cos(phi), en*sinth*sin(phi), en*cos(theta) );
|
||||
theOne->SetMomentum( tempVector ) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
// tabulation of probabilities.
|
||||
G4int it;
|
||||
for (iii=0; iii<nNeu[ii-nIso]; iii++) // find the neutron energy
|
||||
{
|
||||
it = iii;
|
||||
if(theAngular[ii-nIso][iii].GetEnergy()>anEnergy)
|
||||
break;
|
||||
}
|
||||
G4double costh = theAngular[ii-nIso][it].GetCosTh(); // no interpolation yet @@
|
||||
G4double theta = acos(costh);
|
||||
G4double phi = twopi*G4UniformRand();
|
||||
G4double sinth = sin(theta);
|
||||
G4double en = theOne->GetTotalEnergy();
|
||||
G4ThreeVector tmpVector(en*sinth*cos(phi), en*sinth*sin(phi), en*costh );
|
||||
theOne->SetMomentum( tmpVector ) ;
|
||||
}
|
||||
}
|
||||
thePhotons->insert(theOne);
|
||||
}
|
||||
else
|
||||
{
|
||||
delete thePhotons;
|
||||
thePhotons = NULL; // no gamma data available; some work needed @@@@@@@
|
||||
}
|
||||
return thePhotons;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
#include "G4NeutronHPProduct.hh"
|
||||
#include "Randomize.hh"
|
||||
#include "G4Proton.hh"
|
||||
|
||||
G4ReactionProductVector * G4NeutronHPProduct::Sample(G4double anEnergy)
|
||||
{
|
||||
if(theDist == NULL) return NULL;
|
||||
G4ReactionProductVector * result = new G4ReactionProductVector;
|
||||
G4double mean = theYield.GetY(anEnergy);
|
||||
G4int multi;
|
||||
multi = G4int(mean+0.0001);
|
||||
if(theMassCode==0) multi = RandPoisson::shoot(mean); // @@@@gammas. please X-check this
|
||||
theDist->SetTarget(theTarget);
|
||||
theDist->SetNeutron(theNeutron);
|
||||
G4int i;
|
||||
G4double eMax = GetTarget()->GetMass()+GetNeutron()->GetMass()
|
||||
- theActualStateQValue;
|
||||
theCurrentMultiplicity = mean;
|
||||
G4ReactionProduct * tmp;
|
||||
for(i=0;i<multi;i++)
|
||||
{
|
||||
tmp = theDist->Sample(anEnergy, theMassCode, theMass);
|
||||
if(tmp != NULL) result->insert(tmp);
|
||||
}
|
||||
if(multi == 0)
|
||||
{
|
||||
tmp = theDist->Sample(anEnergy, theMassCode, theMass);
|
||||
delete tmp;
|
||||
}
|
||||
if(theTarget->GetMass()<2*GeV) // @@@ take care of residuals in all cases
|
||||
{
|
||||
tmp = theDist->Sample(anEnergy, theMassCode, theMass);
|
||||
tmp->SetDefinition(G4Proton::Proton());
|
||||
if(tmp != NULL) result->insert(tmp);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
#include "G4NeutronHPSCFissionFS.hh"
|
||||
|
||||
void G4NeutronHPSCFissionFS::Init (G4double A, G4double Z, G4String & dirName, G4String & aFSType)
|
||||
{
|
||||
G4String aString = "/SC/";
|
||||
G4NeutronHPFissionBaseFS::Init(A, Z, dirName, aString);
|
||||
}
|
||||
|
||||
G4DynamicParticleVector * G4NeutronHPSCFissionFS::ApplyYourself(G4int NNeutrons)
|
||||
{
|
||||
G4DynamicParticleVector * aResult;
|
||||
// G4cout <<"G4NeutronHPSCFissionFS::ApplyYourself +"<<endl;
|
||||
aResult = G4NeutronHPFissionBaseFS::ApplyYourself(NNeutrons);
|
||||
return aResult;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
#include "G4NeutronHPT2AInelasticFS.hh"
|
||||
#include "G4Nucleus.hh"
|
||||
#include "G4Alpha.hh"
|
||||
|
||||
G4ParticleChange * G4NeutronHPT2AInelasticFS::ApplyYourself(const G4Track & theTrack)
|
||||
{
|
||||
// these are the particle types in the final state
|
||||
|
||||
G4ParticleDefinition * theDefs[3];
|
||||
theDefs[0] = G4Triton::Triton();
|
||||
theDefs[1] = G4Alpha::Alpha();
|
||||
theDefs[2] = G4Alpha::Alpha();
|
||||
|
||||
// fill the final state
|
||||
G4NeutronHPInelasticBaseFS::BaseApply(theTrack, theDefs, 3);
|
||||
|
||||
// return the result
|
||||
return &theResult;
|
||||
}
|
||||
|
||||
void G4NeutronHPT2AInelasticFS::
|
||||
Init (G4double A, G4double Z, G4String & dirName, G4String & aFSType)
|
||||
{
|
||||
G4NeutronHPInelasticBaseFS::Init(A, Z, dirName, aFSType);
|
||||
G4double ResidualA = A-10;
|
||||
G4double ResidualZ = Z-5;
|
||||
G4NeutronHPInelasticBaseFS::InitGammas(ResidualA, ResidualZ);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
#include "G4NeutronHPTCFissionFS.hh"
|
||||
|
||||
void G4NeutronHPTCFissionFS::Init (G4double A, G4double Z, G4String & dirName, G4String & aFSType0)
|
||||
{
|
||||
G4String aString = "/TC/";
|
||||
G4NeutronHPFissionBaseFS::Init(A, Z, dirName, aString);
|
||||
}
|
||||
|
||||
G4DynamicParticleVector * G4NeutronHPTCFissionFS::ApplyYourself(G4int NNeutrons)
|
||||
{
|
||||
G4DynamicParticleVector * aResult;
|
||||
// G4cout <<"G4NeutronHPTCFissionFS::ApplyYourself +"<<endl;
|
||||
aResult = G4NeutronHPFissionBaseFS::ApplyYourself(NNeutrons);
|
||||
return aResult;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
#include "G4NeutronHPTInelasticFS.hh"
|
||||
#include "G4Nucleus.hh"
|
||||
#include "G4Triton.hh"
|
||||
|
||||
void G4NeutronHPTInelasticFS::Init (G4double A, G4double Z, G4String & dirName, G4String & aFSType)
|
||||
{
|
||||
G4NeutronHPInelasticCompFS::Init(A, Z, dirName, aFSType);
|
||||
G4double ResidualA = A-2;
|
||||
G4double ResidualZ = Z-1;
|
||||
G4NeutronHPInelasticCompFS::InitGammas(ResidualA, ResidualZ);
|
||||
}
|
||||
|
||||
G4ParticleChange * G4NeutronHPTInelasticFS::ApplyYourself(const G4Track & theTrack)
|
||||
{
|
||||
|
||||
// do the final state
|
||||
G4NeutronHPInelasticCompFS::CompositeApply(theTrack, G4Triton::Triton());
|
||||
|
||||
// return the result
|
||||
return &theResult;
|
||||
}
|
||||
@@ -0,0 +1,226 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
#include "G4NeutronHPVector.hh"
|
||||
|
||||
G4NeutronHPVector::G4NeutronHPVector()
|
||||
{
|
||||
theData = new G4NeutronHPDataPoint[100];
|
||||
nPoints=100;
|
||||
nEntries=0;
|
||||
Verbose=0;
|
||||
theIntegral=NULL;
|
||||
totalIntegral=-1;
|
||||
}
|
||||
|
||||
G4NeutronHPVector::~G4NeutronHPVector()
|
||||
{
|
||||
// if(Verbose==1)G4cout <<"G4NeutronHPVector::~G4NeutronHPVector"<<endl;
|
||||
if(theData!=NULL)
|
||||
{
|
||||
delete [] theData;
|
||||
}
|
||||
// if(Verbose==1)G4cout <<"Vector: delete theData"<<endl;
|
||||
if(theIntegral!=NULL) delete [] theIntegral;
|
||||
// if(Verbose==1)G4cout <<"Vector: delete theIntegral"<<endl;
|
||||
}
|
||||
|
||||
G4double G4NeutronHPVector::GetXsec(G4double e)
|
||||
{
|
||||
if(nEntries <= 1)
|
||||
{
|
||||
if(nEntries == 0) return 0;
|
||||
return theData[0].GetY();
|
||||
}
|
||||
G4int found = 0;
|
||||
G4int low = 0;
|
||||
G4int high = 0;
|
||||
G4double eps = 0.00001*e; // fast fix of precision problems, needs improvement
|
||||
// if(Verbose==1) G4cout <<"G4NeutronHPVector::GetXsec";
|
||||
if(e<=theData[0].GetX()) return theData[0].GetY();
|
||||
G4int i=0, ii;
|
||||
for (ii=0; ii<nEntries/10+1; ii++) // von null weg, weil sonst <10 im argen liegt.
|
||||
{
|
||||
i = ii;
|
||||
if(theData[10*i].GetX()+eps>e) break;
|
||||
}
|
||||
// if(Verbose==1) G4cout << low<<" "<<high<<" "<<i<<" "<<nEntries<<" ";
|
||||
if(i!=(nEntries/10))
|
||||
{
|
||||
i=10*i;
|
||||
for (G4int j=0; j<11; j++)
|
||||
{
|
||||
if(theData[i].GetX()<e+eps) break;
|
||||
i--;
|
||||
}
|
||||
if(i>nEntries-2) i = nEntries-2;
|
||||
low = i;
|
||||
high = i+1;
|
||||
}
|
||||
else
|
||||
{
|
||||
i=max(0,10*(i-1));
|
||||
while (i<nEntries)
|
||||
{
|
||||
if(theData[i].GetX()>e) break;
|
||||
i++;
|
||||
}
|
||||
if(i>nEntries-1) i = nEntries-1;
|
||||
low = i-1;
|
||||
high = i;
|
||||
}
|
||||
// if(Verbose==1) G4cout << "sss"<<low<<" "<<high<<" ";
|
||||
G4double x1, x2, y1, y2, x, y;
|
||||
while ( theData[low].GetX()-e > 0.0000001*e )
|
||||
{
|
||||
low--;
|
||||
if(low<0) return theData[0].GetY();
|
||||
}
|
||||
while ( theData[high].GetX()-e < -0.0000001*e && high!=nEntries-1)
|
||||
{
|
||||
high++;
|
||||
}
|
||||
while( theData[high].GetX()-theData[low].GetX()<0.0000001*e)
|
||||
{
|
||||
if(high<nEntries-1)
|
||||
{
|
||||
high++;
|
||||
}
|
||||
else
|
||||
{
|
||||
low--;
|
||||
if(low<0) return theData[0].GetY();
|
||||
}
|
||||
}
|
||||
// if(Verbose==1) G4cout << "ddd"<<low<<" "<<high<<" ";
|
||||
x = e;
|
||||
x1 = theData[low] .GetX();
|
||||
x2 = theData[high].GetX();
|
||||
y1 = theData[low] .GetY();
|
||||
y2 = theData[high].GetY();
|
||||
y = theInt.Interpolate(theManager.GetScheme(high), x, x1, x2, y1, y2);
|
||||
return y;
|
||||
}
|
||||
|
||||
void G4NeutronHPVector::Dump()
|
||||
{
|
||||
G4cout << nEntries<<endl;
|
||||
for(G4int i=0; i<nEntries; i++)
|
||||
{
|
||||
G4cout << theData[i].GetX()<<" ";
|
||||
G4cout << theData[i].GetY()<<" ";
|
||||
if (i!=1&&i==5*(i/5)) G4cout << endl;
|
||||
}
|
||||
G4cout << endl;
|
||||
}
|
||||
|
||||
void G4NeutronHPVector::Check(G4int i)
|
||||
{
|
||||
// G4cout << "1: i: "<<i<<" nEntries: "<<nEntries<<" nPoints: "<<nPoints<<endl;
|
||||
if(i>nEntries) G4Exception("Skipped some index numbers in G4NeutronHPVector");
|
||||
if(i==nPoints)
|
||||
{
|
||||
nPoints += 50;
|
||||
// G4cout << "2a: i: "<<i<<" nEntries: "<<nEntries<<" nPoints: "<<nPoints<<endl;
|
||||
G4NeutronHPDataPoint * buff = new G4NeutronHPDataPoint[nPoints];
|
||||
// G4cout << "2b: i: "<<i<<" nEntries: "<<nEntries<<" nPoints: "<<nPoints<<endl;
|
||||
if(nPoints!=50)
|
||||
{
|
||||
// G4cout << "copying 1: nEntries="<<nEntries<<" nPoints="<<nPoints<<endl;
|
||||
for (G4int j=0; j<nEntries; j++) buff[j] = theData[j];
|
||||
// G4cout << "copying 2"<<endl;
|
||||
delete [] theData;
|
||||
// G4cout << "3: i: "<<i<<" nEntries: "<<nEntries<<" nPoints: "<<nPoints<<endl;
|
||||
}
|
||||
theData = buff;
|
||||
}
|
||||
if(i==nEntries) nEntries=i+1;
|
||||
// G4cout << "4: i: "<<i<<" nEntries: "<<nEntries<<" nPoints: "<<nPoints<<endl;
|
||||
}
|
||||
|
||||
void G4NeutronHPVector::
|
||||
Merge(G4InterpolationScheme aScheme, G4double aValue,
|
||||
G4NeutronHPVector * active, G4NeutronHPVector * passive)
|
||||
{
|
||||
// interpolate between labels according to aScheme, cut at aValue,
|
||||
// continue in unknown areas by substraction of the last difference.
|
||||
|
||||
CleanUp();
|
||||
G4int s = 0, n=0, i=0, m=0;
|
||||
G4bool flag;
|
||||
G4NeutronHPVector * tmp;
|
||||
G4int a = s, p = n, t;
|
||||
while ( a<active->GetVectorLength() )
|
||||
{
|
||||
if(active->GetEnergy(a) <= passive->GetEnergy(p))
|
||||
{
|
||||
G4double xa = active->GetEnergy(a);
|
||||
G4double yy = theInt.Interpolate(aScheme, aValue, active->GetLabel(), passive->GetLabel(),
|
||||
active->GetXsec(a), passive->GetXsec(xa));
|
||||
SetData(m, xa, yy);
|
||||
theManager.AppendScheme(m, active->GetScheme(a));
|
||||
m++;
|
||||
a++;
|
||||
G4double xp = passive->GetEnergy(p);
|
||||
if( abs(abs(xp-xa)/xa)<0.0000001&&a<active->GetVectorLength() )
|
||||
{
|
||||
p++;
|
||||
tmp = active; t=a;
|
||||
active = passive; a=p;
|
||||
passive = tmp; p=t;
|
||||
}
|
||||
} else {
|
||||
tmp = active; t=a;
|
||||
active = passive; a=p;
|
||||
passive = tmp; p=t;
|
||||
}
|
||||
}
|
||||
|
||||
G4double deltaX = passive->GetXsec(GetEnergy(m-1)) - GetXsec(m-1);
|
||||
while (p!=passive->GetVectorLength()&&passive->GetEnergy(p)<=aValue)
|
||||
{
|
||||
G4double anX;
|
||||
anX = passive->GetXsec(p)-deltaX;
|
||||
if(anX>0)
|
||||
{
|
||||
if(abs(GetEnergy(m-1)-passive->GetEnergy(p))/passive->GetEnergy(p)>0.0000001)
|
||||
{
|
||||
SetData(m, passive->GetEnergy(p), anX);
|
||||
theManager.AppendScheme(m++, passive->GetScheme(p));
|
||||
}
|
||||
}
|
||||
p++;
|
||||
}
|
||||
}
|
||||
|
||||
void G4NeutronHPVector::ThinOut(G4double precision)
|
||||
{
|
||||
G4NeutronHPDataPoint * aBuff = new G4NeutronHPDataPoint[nPoints];
|
||||
G4double x, x1, x2, y, y1, y2;
|
||||
G4int count = 1, current = 1, start = 1;
|
||||
aBuff[0] = theData[0];
|
||||
while(current < GetVectorLength())
|
||||
{
|
||||
x1=aBuff[count].GetX();
|
||||
x2=theData[current].GetX();
|
||||
y1=aBuff[count].GetY();
|
||||
y2=theData[current].GetY();
|
||||
for(G4int j=start; j<current; j++)
|
||||
{
|
||||
x = theData[j].GetX();
|
||||
y = theInt.Lin(x, x1, x2, y1, y2);
|
||||
if (abs(y-theData[j].GetY())>precision*y)
|
||||
{
|
||||
start = current;
|
||||
aBuff[count] = theData[current-1];
|
||||
count++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
current++ ;
|
||||
}
|
||||
aBuff[count] = theData[GetVectorLength()-1];
|
||||
delete theData;
|
||||
theData = aBuff;
|
||||
nEntries = count;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
// neutron_hp -- source file
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
#include "G4NeutronHPWattSpectrum.hh"
|
||||
|
||||
G4double G4NeutronHPWattSpectrum::Sample(G4double anEnergy)
|
||||
{
|
||||
G4double a = theApar.GetY(anEnergy)*eV;
|
||||
G4double b = theBpar.GetY(anEnergy)/eV;
|
||||
G4double result;
|
||||
G4double random, cut, max;
|
||||
max = sinh(sqrt(b*15.*a));
|
||||
do
|
||||
{
|
||||
random = G4UniformRand();
|
||||
result = -a*log(random);
|
||||
cut = G4UniformRand();
|
||||
}
|
||||
while(cut>sinh(sqrt(b*result))/max);
|
||||
return result;
|
||||
}
|
||||
Reference in New Issue
Block a user