Import Geant4 10.6.0 source tree

This commit is contained in:
Gabriele Cosmo
2019-12-06 15:12:28 +01:00
parent b2a62ae692
commit 5baee230e9
2997 changed files with 141580 additions and 98673 deletions
+1 -1
View File
@@ -1040,7 +1040,7 @@ G4FFG_FUNCTIONENTER__
// Generate the file location starting in the Geant4 data directory
std::ostringstream DirectoryName;
DirectoryName << getenv("G4NEUTRONHPDATA") << G4FFGDefaultValues::ENDFFissionDataLocation;
DirectoryName << std::getenv("G4NEUTRONHPDATA") << G4FFGDefaultValues::ENDFFissionDataLocation;
// Return the directory structure
G4FFG_FUNCTIONLEAVE__
@@ -49,9 +49,9 @@
SetMaxEnergy( 20.*MeV );
/*
// G4cout << "Capture : start of construction!!!!!!!!"<<G4endl;
if(!getenv("G4NEUTRONHPDATA"))
if(!std::getenv("G4NEUTRONHPDATA"))
throw G4HadronicException(__FILE__, __LINE__, "Please setenv G4NEUTRONHPDATA to point to the neutron cross-section files.");
dirName = getenv("G4NEUTRONHPDATA");
dirName = std::getenv("G4NEUTRONHPDATA");
G4String tString = "/Capture";
dirName = dirName + tString;
numEle = G4Element::GetNumberOfElements();
@@ -100,7 +100,7 @@
//if ( numEle < (G4int)G4Element::GetNumberOfElements() ) addChannelForNewElement();
G4ParticleHPManager::GetInstance()->OpenReactionWhiteBoard();
if(getenv("NeutronHPCapture")) G4cout <<" ####### G4ParticleHPCapture called"<<G4endl;
if(std::getenv("NeutronHPCapture")) G4cout <<" ####### G4ParticleHPCapture called"<<G4endl;
const G4Material * theMaterial = aTrack.GetMaterial();
G4int n = theMaterial->GetNumberOfElements();
G4int index = theMaterial->GetElement(0)->GetIndex();
@@ -207,9 +207,9 @@ void G4ParticleHPCapture::BuildPhysicsTable(const G4ParticleDefinition&)
return;
}
if ( !getenv("G4NEUTRONHPDATA") )
if ( !std::getenv("G4NEUTRONHPDATA") )
throw G4HadronicException(__FILE__, __LINE__, "Please setenv G4NEUTRONHPDATA to point to the neutron cross-section files.");
dirName = getenv("G4NEUTRONHPDATA");
dirName = std::getenv("G4NEUTRONHPDATA");
G4String tString = "/Capture";
dirName = dirName + tString;
@@ -149,7 +149,7 @@ void G4ParticleHPCaptureData::BuildPhysicsTable(const G4ParticleDefinition& aP)
static G4ThreadLocal G4ElementTable *theElementTable = 0 ; if (!theElementTable) theElementTable= G4Element::GetElementTable();
for( size_t i=0; i<numberOfElements; ++i )
{
if(getenv("CaptureDataIndexDebug"))
if(std::getenv("CaptureDataIndexDebug"))
{
G4int index_debug = ((*theElementTable)[i])->GetIndex();
G4cout << "IndexDebug "<< i <<" "<<index_debug<<G4endl;
@@ -33,6 +33,9 @@
//
// P. Arce, June-2014 Conversion neutron_hp to particle_hp
//
// June-2019 - E. Mendoza --> Modification to allow using an incomplete data library if the G4NEUTRONHP_SKIP_MISSING_ISOTOPES environmental flag is defined. The missing XS are set to 0.
#include <stdlib.h>
#include "G4ParticleHPChannel.hh"
@@ -88,7 +91,7 @@
*/
//if(Z=theElement->GetZ()-5) throw G4HadronicException(__FILE__, __LINE__, "Channel: Do not know what to do with this material");
// Bug fix by TK on behalf of AH
if ( Z <=theElement->GetZ()-5 ) throw G4HadronicException(__FILE__, __LINE__, "Channel: Do not know what to do with this material");
//if ( Z <=theElement->GetZ()-5 ) throw G4HadronicException(__FILE__, __LINE__, "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 +=
@@ -171,7 +171,7 @@ G4ThreadLocal G4int G4ParticleHPChannelList::trycounter = 0;
}
delete [] running;
#ifdef G4PHPDEBUG
if( getenv("G4ParticleHPDebug") ) G4cout << " G4ParticleHPChannelList SELECTED ISOTOPE " << isotope << " SELECTED CHANNEL " << lChan << G4endl;
if( std::getenv("G4ParticleHPDebug") ) G4cout << " G4ParticleHPChannelList SELECTED ISOTOPE " << isotope << " SELECTED CHANNEL " << lChan << G4endl;
#endif
return theChannels[lChan]->ApplyYourself(aTrack, isotope);
}
@@ -38,6 +38,8 @@
//
// P. Arce, June-2014 Conversion neutron_hp to particle_hp
//
// June-2019 - E. Mendoza --> redefinition of the residual mass to consider incident particles different than neutrons.
#include "G4ParticleHPContAngularPar.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
@@ -64,7 +66,7 @@ G4ParticleHPContAngularPar::G4ParticleHPContAngularPar( G4ParticleDefinition* pr
fCache.Get()->currentMeanEnergy = -2;
fCache.Get()->fresh = true;
adjustResult = true;
if ( getenv( "G4PHP_DO_NOT_ADJUST_FINAL_STATE" ) ) adjustResult = false;
if ( std::getenv( "G4PHP_DO_NOT_ADJUST_FINAL_STATE" ) ) adjustResult = false;
theMinEner = DBL_MAX;
theMaxEner = -DBL_MAX;
@@ -79,12 +81,12 @@ G4ParticleHPContAngularPar::G4ParticleHPContAngularPar( G4ParticleDefinition* pr
void G4ParticleHPContAngularPar::Init(std::istream & aDataFile, G4ParticleDefinition* projectile)
{
adjustResult = true;
if ( getenv( "G4PHP_DO_NOT_ADJUST_FINAL_STATE" ) ) adjustResult = false;
if ( std::getenv( "G4PHP_DO_NOT_ADJUST_FINAL_STATE" ) ) adjustResult = false;
theProjectile = projectile;
aDataFile >> theEnergy >> nEnergies >> nDiscreteEnergies >> nAngularParameters;
/*if( getenv("G4PHPTEST") )*/
/*if( std::getenv("G4PHPTEST") )*/
theEnergy *= eV;
theAngular = new G4ParticleHPList [nEnergies];
for(G4int i=0; i<nEnergies; i++)
@@ -103,7 +105,7 @@ G4ParticleHPContAngularPar::G4ParticleHPContAngularPar( G4ParticleDefinition* pr
G4ParticleHPContAngularPar::Sample(G4double anEnergy, G4double massCode, G4double /*targetMass*/,
G4int angularRep, G4int /*interpolE*/ )
{
if( getenv("G4PHPTEST") ) G4cout << " G4ParticleHPContAngularPar::Sample " << anEnergy << " " << massCode << " " << angularRep << G4endl; //GDEB
if( std::getenv("G4PHPTEST") ) G4cout << " G4ParticleHPContAngularPar::Sample " << anEnergy << " " << massCode << " " << angularRep << G4endl; //GDEB
if ( fCache.Get() == 0 ) cacheInit();
G4ReactionProduct * result = new G4ReactionProduct;
G4int Z = static_cast<G4int>(massCode/1000);
@@ -467,7 +469,7 @@ G4ParticleHPContAngularPar::G4ParticleHPContAngularPar( G4ParticleDefinition* pr
G4double * running = new G4double[nEnergies];
running[0]=0;
G4double weighted = 0;
if( getenv("G4PHPTEST") ) G4cout << " G4ParticleHPContAngularPar::Sample nEnergies " << nEnergies << G4endl;
if( std::getenv("G4PHPTEST") ) G4cout << " G4ParticleHPContAngularPar::Sample nEnergies " << nEnergies << G4endl;
for(j=1; j<nEnergies; j++)
{
if(j!=0) running[j]=running[j-1];
@@ -477,7 +479,7 @@ G4ParticleHPContAngularPar::G4ParticleHPContAngularPar( G4ParticleDefinition* pr
weighted += theInt.GetWeightedBinIntegral(theManager.GetScheme(j-1),
theAngular[j-1].GetLabel(), theAngular[j].GetLabel(),
theAngular[j-1].GetValue(0), theAngular[j].GetValue(0));
if( getenv("G4PHPTEST") ) G4cout << " G4ParticleHPContAngularPar::Sample " << j << " running " << running[j]
if( std::getenv("G4PHPTEST") ) G4cout << " G4ParticleHPContAngularPar::Sample " << j << " running " << running[j]
<< " " << theManager.GetScheme(j-1) << " " << theAngular[j-1].GetLabel() << " " << theAngular[j].GetLabel() << " " << theAngular[j-1].GetValue(0) << " " << theAngular[j].GetValue(0) << G4endl; //GDEB
}
// cash the mean energy in this distribution
@@ -510,13 +512,16 @@ G4ParticleHPContAngularPar::G4ParticleHPContAngularPar( G4ParticleDefinition* pr
y2 = theAngular[itt].GetLabel();
fsEnergy = theInt.Interpolate(theManager.GetInverseScheme(itt-1),
x, x1,x2,y1,y2);
if( getenv("G4PHPTEST") ) G4cout << itt << " G4particleHPContAngularPar fsEnergy " << fsEnergy << " " << theManager.GetInverseScheme(itt-1) << " x " << x << " " << x1 << " " << x2 << " y " << y1 << " " << y2 << G4endl; //GDEB
if( std::getenv("G4PHPTEST") ) G4cout << itt << " G4particleHPContAngularPar fsEnergy " << fsEnergy << " " << theManager.GetInverseScheme(itt-1) << " x " << x << " " << x1 << " " << x2 << " y " << y1 << " " << y2 << G4endl; //GDEB
// for theta interpolate the compoundFractions
G4double cLow = theAngular[itt-1].GetValue(1);
G4double cHigh = theAngular[itt].GetValue(1);
compoundFraction = theInt.Interpolate(theManager.GetScheme(itt),
fsEnergy, y1, y2, cLow,cHigh);
if( getenv("G4PHPTEST") ) G4cout << itt << " G4particleHPContAngularPar compoundFraction " << compoundFraction << " E " << fsEnergy << " " << theManager.GetScheme(itt) << " ener " << fsEnergy << " y " << y1 << " " << y2 << " cLH " << cLow << " " << cHigh << G4endl; //GDEB
if ( compoundFraction > 1.0 ) compoundFraction = 1.0; // Protection against unphysical interpolation
if( std::getenv("G4PHPTEST") ) G4cout << itt << " G4particleHPContAngularPar compoundFraction " << compoundFraction << " E " << fsEnergy << " " << theManager.GetScheme(itt) << " ener " << fsEnergy << " y " << y1 << " " << y2 << " cLH " << cLow << " " << cHigh << G4endl; //GDEB
delete [] running;
// get cosTh
@@ -530,18 +535,19 @@ G4ParticleHPContAngularPar::G4ParticleHPContAngularPar( G4ParticleDefinition* pr
if ( targetA == 0 )
targetA = G4int ( fCache.Get()->theTarget->GetMass()/amu_c2 + 0.5 );
G4double targetMass = fCache.Get()->theTarget->GetMass();
G4int residualA = targetA+1-A;
G4int residualZ = targetZ-Z;
G4double residualMass = residualZ*G4Proton::Proton()->GetPDGMass();
residualMass +=(residualA-residualZ)*theProjectile->GetPDGMass();
residualMass -= G4NucleiProperties::GetBindingEnergy( residualA , residualZ );
G4int incidentA=G4int(incidentMass/amu_c2 + 0.5 );
G4int incidentZ=G4int(theProjectile->GetPDGCharge()+ 0.5 );
G4int residualA = targetA+incidentA-A;
G4int residualZ = targetZ+incidentZ-Z;
G4double residualMass =G4NucleiProperties::GetNuclearMass( residualA , residualZ );
G4ParticleHPKallbachMannSyst theKallbach(compoundFraction,
incidentEnergy, incidentMass,
productEnergy, productMass,
residualMass, residualA, residualZ,
targetMass, targetA, targetZ);
targetMass, targetA, targetZ,
incidentA,incidentZ,A,Z);
cosTh = theKallbach.Sample(anEnergy);
if( getenv("G4PHPTEST") ) G4cout << " G4ParticleHPKallbachMannSyst::Sample resulttest " << cosTh << G4endl; //GDEB
if( std::getenv("G4PHPTEST") ) G4cout << " G4ParticleHPKallbachMannSyst::Sample resulttest " << cosTh << G4endl; //GDEB
}
else if(angularRep>10&&angularRep<16)
{
@@ -775,7 +781,7 @@ void G4ParticleHPContAngularPar::BuildByInterpolation(G4double anEnergy, G4Inter
angpar1.theEnergy, angpar2.theEnergy,
val1,
val2);
if( getenv("G4PHPTEST2") ) G4cout << ie << " " << ip << " G4ParticleHPContAngularPar::Merge DiscreteEnergies val1 " << val1 << " val2 " << val2 << " value " << value << G4endl; //GDEB
if( std::getenv("G4PHPTEST2") ) G4cout << ie << " " << ip << " G4ParticleHPContAngularPar::Merge DiscreteEnergies val1 " << val1 << " val2 " << val2 << " value " << value << G4endl; //GDEB
theAngular[ie].SetValue(ip, value);
}
@@ -789,7 +795,7 @@ void G4ParticleHPContAngularPar::BuildByInterpolation(G4double anEnergy, G4Inter
theMinEner = angpar1.GetMinEner() + (theEnergy-angpar1.GetEnergy()) * (angpar2.GetMinEner()-angpar1.GetMinEner())/(angpar2.GetEnergy()-angpar1.GetEnergy());
theMaxEner = angpar1.GetMaxEner() + (theEnergy-angpar1.GetEnergy()) * (angpar2.GetMaxEner()-angpar1.GetMaxEner())/(angpar2.GetEnergy()-angpar1.GetEnergy());
if( getenv("G4PHPTEST2") ) G4cout << " G4ParticleHPContAngularPar::Merge E " << anEnergy << " minmax " << theMinEner << " " << theMaxEner << G4endl; //GDEB
if( std::getenv("G4PHPTEST2") ) G4cout << " G4ParticleHPContAngularPar::Merge E " << anEnergy << " minmax " << theMinEner << " " << theMaxEner << G4endl; //GDEB
//--- Loop to energies of new set
std::set<G4double> energiesTransformed = angpar2.GetEnergiesTransformed();
@@ -833,7 +839,7 @@ void G4ParticleHPContAngularPar::BuildByInterpolation(G4double anEnergy, G4Inter
//---- Energy corresponding to energy transformed
G4double eN = (theMaxEner-theMinEner) * eT + theMinEner;
if( getenv("G4PHPTEST2") ) G4cout << ie << " " << ie1 << " " << ie2 << " G4ParticleHPContAngularPar::loop eT " << eT << " -> eN " << eN << " e1 " << e1 << " e2 " << e2 << G4endl; //GDEB
if( std::getenv("G4PHPTEST2") ) G4cout << ie << " " << ie1 << " " << ie2 << " G4ParticleHPContAngularPar::loop eT " << eT << " -> eN " << eN << " e1 " << e1 << " e2 " << e2 << G4endl; //GDEB
theAngular[ie].SetLabel(eN);
@@ -861,7 +867,7 @@ void G4ParticleHPContAngularPar::BuildByInterpolation(G4double anEnergy, G4Inter
} else if ( value != 0 ) {
throw G4HadronicException(__FILE__, __LINE__, "G4ParticleHPContAngularPar::PrepareTableInterpolation theMaxEner == theMinEner and value != 0.");
}
if( getenv("G4PHPTEST2") ) G4cout << ie << " " << ip << " G4ParticleHPContAngularPar::Merge val1 " << val1 << " val2 " << val2 << " value " << value << G4endl; //GDEB
if( std::getenv("G4PHPTEST2") ) G4cout << ie << " " << ip << " G4ParticleHPContAngularPar::Merge val1 " << val1 << " val2 " << val2 << " value " << value << G4endl; //GDEB
//- val1 = angpar1.theAngular[ie1-1].GetValue(ip) * (maxEner1-minEner1);
//- val2 = angpar2.theAngular[ie2-1].GetValue(ip) * (maxEner2-minEner2);
//- if( getenv("G4PHPTEST2") ) G4cout << ie << " " << ip << " G4ParticleHPContAngularPar::MergeOLD val1 " << val1 << " val2 " << val2 << " value " << value << G4endl; //GDEB
@@ -870,7 +876,7 @@ void G4ParticleHPContAngularPar::BuildByInterpolation(G4double anEnergy, G4Inter
}
}
if( getenv("G4PHPTEST2") ) {
if( std::getenv("G4PHPTEST2") ) {
G4cout << " G4ParticleHPContAngularPar::Merge ANGPAR1 " << G4endl; //GDEB
angpar1.Dump();
G4cout << " G4ParticleHPContAngularPar::Merge ANGPAR2 " << G4endl;
@@ -47,7 +47,7 @@ G4ReactionProduct * G4ParticleHPContEnergyAngular::Sample(G4double anEnergy, G4d
if(theAngular[i].GetEnergy()>=anEnergy) break;
#endif
}
if( getenv("G4PHPTEST") ) G4cout << i << " G4ParticleHPContEnergyAngular dataE " << theAngular[i].GetEnergy() << " > " << anEnergy << " it_theAngular " << it << " interpolation " << theInterpolation << G4endl; //GDEB
if( std::getenv("G4PHPTEST") ) G4cout << i << " G4ParticleHPContEnergyAngular dataE " << theAngular[i].GetEnergy() << " > " << anEnergy << " it_theAngular " << it << " interpolation " << theInterpolation << G4endl; //GDEB
G4double targetMass = GetTarget()->GetMass();
if(it==0)
{
@@ -79,7 +79,7 @@ G4ReactionProduct * G4ParticleHPContEnergyAngular::Sample(G4double anEnergy, G4d
theAngularRep, theInterpolation);
currentMeanEnergy.Put( theAngular[it].MeanEnergyOfThisInteraction() );
#else
if( getenv("G4PHPTEST") ) G4cout << i << " G4ParticleHPContEnergyAngular To BUILDBYINTERPOLATION " << it << " : " << theAngular[it].GetEnergy()<< " , " << theAngular[it].GetNEnergies() << " " << it-1 << " : " << theAngular[it-1].GetEnergy()<< " : " << theAngular[it-1].GetNEnergies() << G4endl; //GDEB
if( std::getenv("G4PHPTEST") ) G4cout << i << " G4ParticleHPContEnergyAngular To BUILDBYINTERPOLATION " << it << " : " << theAngular[it].GetEnergy()<< " , " << theAngular[it].GetNEnergies() << " " << it-1 << " : " << theAngular[it-1].GetEnergy()<< " : " << theAngular[it-1].GetNEnergies() << G4endl; //GDEB
// G4ParticleHPContAngularPar * fAngular = new G4ParticleHPContAngularPar(theProjectile ); //fix start
if (fCacheAngular.Get() == NULL) {
@@ -46,9 +46,9 @@
overrideSuspension = false;
/*
G4ParticleHPElasticFS * theFS = new G4ParticleHPElasticFS;
if(!getenv("G4NEUTRONHPDATA"))
if(!std::getenv("G4NEUTRONHPDATA"))
throw G4HadronicException(__FILE__, __LINE__, "Please setenv G4NEUTRONHPDATA to point to the neutron cross-section files.");
dirName = getenv("G4NEUTRONHPDATA");
dirName = std::getenv("G4NEUTRONHPDATA");
G4String tString = "/Elastic";
dirName = dirName + tString;
// G4cout <<"G4ParticleHPElastic::G4ParticleHPElastic testit "<<dirName<<G4endl;
@@ -199,9 +199,9 @@ void G4ParticleHPElastic::BuildPhysicsTable(const G4ParticleDefinition&)
}
G4ParticleHPElasticFS * theFS = new G4ParticleHPElasticFS;
if(!getenv("G4NEUTRONHPDATA"))
if(!std::getenv("G4NEUTRONHPDATA"))
throw G4HadronicException(__FILE__, __LINE__, "Please setenv G4NEUTRONHPDATA to point to the neutron cross-section files.");
dirName = getenv("G4NEUTRONHPDATA");
dirName = std::getenv("G4NEUTRONHPDATA");
G4String tString = "/Elastic";
dirName = dirName + tString;
for ( G4int i = numEle ; i < (G4int)G4Element::GetNumberOfElements() ; i++ ) {
@@ -31,6 +31,8 @@
//
// P. Arce, June-2014 Conversion neutron_hp to particle_hp
//
// June-2019 - E. Mendoza --> Part of the code trying to preserve the baryonic number has been deleted. One has to assume that it is not preserved when using ENDF-6 data and it caused problems.
#include "G4ParticleHPEnAngCorrelation.hh"
#include "G4LorentzRotation.hh"
#include "G4LorentzVector.hh"
@@ -111,88 +113,12 @@ G4ReactionProductVector * G4ParticleHPEnAngCorrelation::Sample(G4double anEnergy
}
fCache.Get().theTotalMeanEnergy=0;
G4LorentzRotation toLab(toZ.inverse()); //toLab only change axis NOT to LAB system
//- get first number of particles, to check if sum of Z and N is not bigger than target values
std::vector<int> nParticles;
bool bNPOK = true;
//TKDB_PHP_150507
#ifdef PHP_AS_HP
#endif
//TKDB_PHP_161107
G4int iTry(0);
//TKDB_PHP_161107
//TKDB_PHP_150507
do {
G4int sumZ = 0;
G4int sumA = 0;
nParticles.clear();
for(i=0; i<nProducts; i++)
{
G4int massCode = G4int(theProducts[i].GetMassCode());
G4int nPart;
nPart = theProducts[i].GetMultiplicity(anEnergy);
sumZ += massCode/1000 * nPart;
sumA += massCode % 1000 * nPart;
#ifdef G4PHPDEBUG
if( getenv("G4ParticleHPDebug") ) G4cout << i << " G4ParticleHPEnAngCorrelation::MULTIPLICITY " << massCode << " sumZ " << sumZ << " sumA " << sumA << " NPART " << nPart << G4endl;
#endif
nParticles.push_back( nPart );
}
bNPOK = true;
double targetZ = fCache.Get().theTarget->GetDefinition()->GetAtomicNumber();
double targetA = fCache.Get().theTarget->GetDefinition()->GetAtomicMass();
targetZ += fCache.Get().theProjectileRP->GetDefinition()->GetAtomicNumber();
targetA += fCache.Get().theProjectileRP->GetDefinition()->GetAtomicMass();
if ( bAdjustFinalState ) {
/*
G4cout << "TKDB G4ParticleHPEnAngCorrelation::Sample 1" << G4endl;
G4cout << "TKDB "
<< "targetZ = " << targetZ
<< ", targetA = " << targetA
<< ", sumZ = " << sumZ
<< ", sumA = " << sumA
<< ", int( targetZ-sumZ ) = " << int( targetZ-sumZ )
<< ", int( targetA-sumA ) = " << int( targetA-sumA )
//<< ", G4IonTable::GetIonTable()->GetIon ( int(targetZ - sumZ), (int)(targetA - sumA), 0.0 ) = " << G4IonTable::GetIonTable()->GetIon ( int(targetZ - sumZ), (int)(targetA - sumA), 0.0 )
<< G4endl;
*/
//if ( (sumZ != targetZ || sumA != targetA ) &&
// (sumZ > targetZ || sumA > targetA
// || ! G4IonTable::GetIonTable()->GetIon ( int(targetZ - sumZ), (int)(targetA - sumA), 0.0 ) ) ){ // e.g. Z=3, A=2
if ( ( sumZ != targetZ || sumA != targetA )
&& ( sumZ > targetZ || sumA > targetA || (targetZ-sumZ) >= (targetA-sumA) ) ) {
// e.g. Z=3, A=2
bNPOK = false;
//nParticles.clear();
#ifdef G4PHPDEBUG
if ( getenv("G4ParticleHPDebug") )
G4cerr << " WRONG MULTIPLICITY Z= " << sumZ
<< " > " << targetZ
<< " A= " << sumA
<< " > " << targetA << G4endl;
#endif
}
}
//TKDB_PHP_150507
#ifdef PHP_AS_HP
#endif
//TKDB_PHP_161107
iTry++;
if ( iTry > 1024 ) {
G4Exception("G4ParticleHPEnAngCorrelation::Sample",
"Warning",
JustWarning,
"Too many trials were done. Exiting current loop by force. You may have Probably, the result violating (baryon number) conservation law will be obtained.");
bNPOK=true;
}
//TKDB_PHP_161107
//TKDB_PHP_150507
}while(!bNPOK); // Loop checking, 11.05.2015, T. Koi
for(i=0; i<nProducts; i++)
{
G4int nPart = theProducts[i].GetMultiplicity(anEnergy);
//- if( nParticles[i] == 0 ) continue;
it = theProducts[i].Sample(anEnergy,nParticles[i]);
it = theProducts[i].Sample(anEnergy,nPart);
G4double aMeanEnergy = theProducts[i].MeanEnergyOfThisInteraction();
// if( getenv("G4PHPTEST") ) G4cout << " EnAnG energy sampled " << it->operator[](0)->GetKineticEnergy() << " aMeanEnergy " << aMeanEnergy << G4endl; // GDEB
//if(aMeanEnergy>0)
@@ -210,14 +136,14 @@ G4cout << "TKDB "
{
for(unsigned int ii=0; ii<it->size(); ii++)
{
//if(!getenv("G4PHP_NO_LORENTZ_BOOST")) {
//if(!std::getenv("G4PHP_NO_LORENTZ_BOOST")) {
G4LorentzVector pTmp1 (it->operator[](ii)->GetMomentum(),
it->operator[](ii)->GetTotalEnergy());
pTmp1 = toLab*pTmp1;
if( getenv("G4PHPTEST") ) G4cout << " G4particleHPEnAngCorrelation COS THETA " << std::cos(it->operator[](ii)->GetMomentum().theta()) << G4endl;
if( std::getenv("G4PHPTEST") ) G4cout << " G4particleHPEnAngCorrelation COS THETA " << std::cos(it->operator[](ii)->GetMomentum().theta()) << G4endl;
it->operator[](ii)->SetMomentum(pTmp1.vect());
it->operator[](ii)->SetTotalEnergy(pTmp1.e());
if( getenv("G4PHPTEST") ) G4cout << " G4particleHPEnAngCorrelation COS THETA after toLab " << std::cos(it->operator[](ii)->GetMomentum().theta()) << G4endl;
if( std::getenv("G4PHPTEST") ) G4cout << " G4particleHPEnAngCorrelation COS THETA after toLab " << std::cos(it->operator[](ii)->GetMomentum().theta()) << G4endl;
if(frameFlag==1) // target rest //TK 100413 should be LAB?
{
@@ -226,14 +152,14 @@ G4cout << "TKDB "
else if(frameFlag==2 ) // CMS
{
#ifdef G4PHPDEBUG
if( getenv("G4ParticleHPDebug") )
if( std::getenv("G4ParticleHPDebug") )
G4cout <<"G4ParticleHPEnAngCorrelation: before Lorentz boost "<<
it->at(ii)->GetKineticEnergy()<<" "<<
it->at(ii)->GetMomentum()<<G4endl;
#endif
it->operator[](ii)->Lorentz(*(it->operator[](ii)), -1.*theCMS);
#ifdef G4PHPDEBUG
if( getenv("G4ParticleHPDebug") )
if( std::getenv("G4ParticleHPDebug") )
G4cout <<"G4ParticleHPEnAngCorrelation: after Lorentz boost "<<
it->at(ii)->GetKineticEnergy()<<" "<<
it->at(ii)->GetMomentum()<<G4endl;
@@ -242,12 +168,12 @@ G4cout << "TKDB "
//TK120515 migrate frameFlag (MF6 LCT) = 3
else if(frameFlag==3) // CMS A<=4 other LAB
{
if ( theProducts[i].GetMassCode() > 4 ) //Alpha AWP 3.96713
if ( theProducts[i].GetMassCode() > 2004.5 ) //Alpha AWP 3.96713
{
//LAB
it->operator[](ii)->Lorentz(*(it->operator[](ii)), -1.*(*fCache.Get().theTarget)); //TK 100413 Is this really need?
#ifdef G4PHPDEBUG
if( getenv("G4ParticleHPDebug") )
if( std::getenv("G4ParticleHPDebug") )
G4cout <<"G4ParticleHPEnAngCorrelation: after Lorentz boost "<<
it->at(ii)->GetKineticEnergy()<<" "<<
it->at(ii)->GetMomentum()<<G4endl;
@@ -258,7 +184,7 @@ G4cout << "TKDB "
//CMS
it->operator[](ii)->Lorentz(*(it->operator[](ii)), -1.*theCMS);
#ifdef G4PHPDEBUG
if( getenv("G4ParticleHPDebug") )
if( std::getenv("G4ParticleHPDebug") )
G4cout <<"G4ParticleHPEnAngCorrelation: after Lorentz boost "<<
it->at(ii)->GetKineticEnergy()<<" "<<
it->at(ii)->GetMomentum()<<G4endl;
@@ -269,7 +195,7 @@ G4cout << "TKDB "
{
throw G4HadronicException(__FILE__, __LINE__, "G4ParticleHPEnAngCorrelation::Sample: The frame of the finalstate is not specified");
}
if( getenv("G4PHPTEST") ) G4cout << frameFlag << " G4particleHPEnAngCorrelation COS THETA after Lorentz " << std::cos(it->operator[](ii)->GetMomentum().theta()) << G4endl;
if( std::getenv("G4PHPTEST") ) G4cout << frameFlag << " G4particleHPEnAngCorrelation COS THETA after Lorentz " << std::cos(it->operator[](ii)->GetMomentum().theta()) << G4endl;
// }//getenv("G4PHP_NO_LORENTZ_BOOST"))
// G4cout << ii << " EnAnG energy after boost " << it->operator[](ii)->GetKineticEnergy() << G4endl; //GDEB
@@ -71,7 +71,7 @@ void G4ParticleHPFinalState::adjust_final_state ( G4LorentzVector init_4p_lab )
max_SecA = std::max ( max_SecA , theResult.Get()->GetSecondary( i )->GetParticle()->GetDefinition()->GetAtomicMass() );
if ( theResult.Get()->GetSecondary( i )->GetParticle()->GetDefinition()->GetAtomicMass() == max_SecA ) imaxA = i;
#ifdef G4PHPDEBUG
if( getenv("G4ParticleHPDebug")) G4cout << "G4ParticleHPFinalState::adjust_final_stat SECO " << i << " " <<theResult.Get()->GetSecondary( i )->GetParticle()->GetDefinition()->GetParticleName() << G4endl;
if( std::getenv("G4ParticleHPDebug")) G4cout << "G4ParticleHPFinalState::adjust_final_stat SECO " << i << " " <<theResult.Get()->GetSecondary( i )->GetParticle()->GetDefinition()->GetParticleName() << G4endl;
#endif
}
@@ -100,7 +100,7 @@ void G4ParticleHPFinalState::adjust_final_state ( G4LorentzVector init_4p_lab )
}
#ifdef G4PHPDEBUG
if( getenv("G4ParticleHPDebug")) G4cout << "G4ParticleHPFinalState::adjust_final_stat BaseZ " << baseZNew << " BaseA " << baseANew << " sum_Z " << sum_Z << " sum_A " << sum_A << G4endl;
if( std::getenv("G4ParticleHPDebug")) G4cout << "G4ParticleHPFinalState::adjust_final_stat BaseZ " << baseZNew << " BaseA " << baseANew << " sum_Z " << sum_Z << " sum_A " << sum_A << G4endl;
#endif
G4bool needOneMoreSec = false;
@@ -135,7 +135,7 @@ void G4ParticleHPFinalState::adjust_final_state ( G4LorentzVector init_4p_lab )
else
{
#ifdef G4PHPDEBUG
if( getenv("G4ParticleHPDebug")) G4cout << this << "G4ParticleHPFinalState oneMoreSec_pd Z " << baseZNew << " - " << sum_Z << " A " << baseANew << " - " << sum_A << " projectile " << theProjectile->GetParticleName() << G4endl;
if( std::getenv("G4ParticleHPDebug")) G4cout << this << "G4ParticleHPFinalState oneMoreSec_pd Z " << baseZNew << " - " << sum_Z << " A " << baseANew << " - " << sum_A << " projectile " << theProjectile->GetParticleName() << G4endl;
#endif
oneMoreSec_pd = G4IonTable::GetIonTable()->GetIon ( int(baseZNew - sum_Z) , (int)(baseANew - sum_A) , 0.0 );
if( !oneMoreSec_pd ) {
@@ -46,9 +46,9 @@
SetMinEnergy( 0.0 );
SetMaxEnergy( 20.*MeV );
/*
if(!getenv("G4NEUTRONHPDATA"))
if(!std::getenv("G4NEUTRONHPDATA"))
throw G4HadronicException(__FILE__, __LINE__, "Please setenv G4NEUTRONHPDATA to point to the neutron cross-section files.");
dirName = getenv("G4NEUTRONHPDATA");
dirName = std::getenv("G4NEUTRONHPDATA");
G4String tString = "/Fission";
dirName = dirName + tString;
numEle = G4Element::GetNumberOfElements();
@@ -198,9 +198,9 @@ void G4ParticleHPFission::BuildPhysicsTable(const G4ParticleDefinition&)
return;
}
if ( !getenv("G4NEUTRONHPDATA") )
if ( !std::getenv("G4NEUTRONHPDATA") )
throw G4HadronicException(__FILE__, __LINE__, "Please setenv G4NEUTRONHPDATA to point to the neutron cross-section files.");
dirName = getenv("G4NEUTRONHPDATA");
dirName = std::getenv("G4NEUTRONHPDATA");
G4String tString = "/Fission";
dirName = dirName + tString;
@@ -50,8 +50,8 @@ G4ParticleHPInelastic::G4ParticleHPInelastic(G4ParticleDefinition* projectile, c
,theProjectile(projectile)
{
G4String baseName;
if ( getenv("G4PARTICLEHPDATA") ) {
baseName = getenv( "G4PARTICLEHPDATA" );
if ( std::getenv("G4PARTICLEHPDATA") ) {
baseName = std::getenv( "G4PARTICLEHPDATA" );
}
//const char* dataDirVariable;
G4String particleName;
@@ -81,12 +81,12 @@ G4ParticleHPInelastic::G4ParticleHPInelastic(G4ParticleDefinition* projectile, c
SetMaxEnergy( 20.*MeV );
// G4cout << " entering G4ParticleHPInelastic constructor"<<G4endl;
if ( !getenv("G4PARTICLEHPDATA") && !getenv(dataDirVariable) ) {
if ( !std::getenv("G4PARTICLEHPDATA") && !std::getenv(dataDirVariable) ) {
G4String message( "Please set the environement variable " + G4String(dataDirVariable) + " to point to the " + theProjectile->GetParticleName() + " cross-section files." );
throw G4HadronicException(__FILE__, __LINE__,message.c_str());
}
if ( getenv(dataDirVariable) ) {
dirName = getenv(dataDirVariable);
if ( std::getenv(dataDirVariable) ) {
dirName = std::getenv(dataDirVariable);
} else {
dirName = baseName + "/" + particleName;
}
@@ -276,7 +276,7 @@ throw G4HadronicException(__FILE__, __LINE__, "Channel: Do not know what to do w
xSec[i] *= rWeight;
sum+=xSec[i];
#ifdef G4PHPDEBUG
if( getenv("G4ParticleHPDebug") ) G4cout << " G4ParticleHPInelastic XSEC ELEM " << i << " = " << xSec[i] << G4endl;
if( std::getenv("G4ParticleHPDebug") ) G4cout << " G4ParticleHPInelastic XSEC ELEM " << i << " = " << xSec[i] << G4endl;
#endif
}
@@ -294,7 +294,7 @@ throw G4HadronicException(__FILE__, __LINE__, "Channel: Do not know what to do w
}
#ifdef G4PHPDEBUG
if( getenv("G4ParticleHPDebug") ) G4cout << " G4ParticleHPInelastic SELECTED ELEM " << it << " = " << theMaterial->GetElement(it)->GetName() << " FROM MATERIAL " << theMaterial->GetName() << G4endl;
if( std::getenv("G4ParticleHPDebug") ) G4cout << " G4ParticleHPInelastic SELECTED ELEM " << it << " = " << theMaterial->GetElement(it)->GetName() << " FROM MATERIAL " << theMaterial->GetName() << G4endl;
#endif
//return theInelastic[index].ApplyYourself(theMaterial->GetElement(it), aTrack);
G4HadFinalState* result = ((*theInelastic)[index])->ApplyYourself(theMaterial->GetElement(it), aTrack);
@@ -315,7 +315,7 @@ throw G4HadronicException(__FILE__, __LINE__, "Channel: Do not know what to do w
G4ParticleHPManager::GetInstance()->CloseReactionWhiteBoard();
//GDEB
if( getenv("G4PHPTEST") ) {
if( std::getenv("G4PHPTEST") ) {
G4HadSecondary* seco = result->GetSecondary(0);
if(seco) {
G4ThreeVector secoMom = seco->GetParticle()->GetMomentum();
@@ -484,11 +484,11 @@ void G4ParticleHPInelastic::BuildPhysicsTable(const G4ParticleDefinition& projec
G4String message("G4ParticleHPInelastic may only be called for neutron, proton, deuteron, triton, He3 or alpha, while it is called for " + projectile.GetParticleName());
throw G4HadronicException(__FILE__, __LINE__,message.c_str());
}
if(!getenv(dataDirVariable)){
if(!std::getenv(dataDirVariable)){
G4String message("Please set the environement variable " + G4String(dataDirVariable) + " to point to the " + projectile.GetParticleName() + " cross-section files.");
throw G4HadronicException(__FILE__, __LINE__,message.c_str());
}
dirName = getenv(dataDirVariable);
dirName = std::getenv(dataDirVariable);
G4cout << dirName << G4endl;
G4String tString = "/Inelastic";
@@ -34,6 +34,9 @@
//
// P. Arce, June-2014 Conversion neutron_hp to particle_hp
//
// June-2019 - E. Mendoza --> Added protection against residual with Z<0 or A<Z + adjust_final_state is not applied when data is in MF=6 format (no correlated particle emission) + bug correction (add Q value info to G4ParticleHPNBodyPhaseSpace).
#include "G4ParticleHPInelasticBaseFS.hh"
#include "G4ParticleHPManager.hh"
#include "G4Nucleus.hh"
@@ -74,16 +77,16 @@ void G4ParticleHPInelasticBaseFS::InitGammas(G4double AR, G4double ZR)
void G4ParticleHPInelasticBaseFS::Init (G4double A, G4double Z, G4int M, G4String & dirName, G4String & bit, G4ParticleDefinition* )
{
gammaPath = "/Inelastic/Gammas/";
if(!getenv("G4NEUTRONHPDATA"))
if(!std::getenv("G4NEUTRONHPDATA"))
throw G4HadronicException(__FILE__, __LINE__, "Please setenv G4NEUTRONHPDATA to point to the neutron cross-section files where Inelastic/Gammas data is found.");
G4String tBase = getenv("G4NEUTRONHPDATA");
G4String tBase = std::getenv("G4NEUTRONHPDATA");
gammaPath = tBase+gammaPath;
G4String tString = dirName;
G4bool dbool;
G4ParticleHPDataUsed aFile = theNames.GetName(static_cast<G4int>(A), static_cast<G4int>(Z), M,tString, bit, dbool);
G4String filename = aFile.GetName();
#ifdef G4PHPDEBUG
if( getenv("G4ParticleHPDebug") ) G4cout << " G4ParticleHPInelasticBaseFS::Init FILE " << filename << G4endl;
if( std::getenv("G4ParticleHPDebug") ) G4cout << " G4ParticleHPInelasticBaseFS::Init FILE " << filename << G4endl;
#endif
SetAZMs( A, Z, M, aFile);
//theBaseA = aFile.GetA();
@@ -94,7 +97,7 @@ void G4ParticleHPInelasticBaseFS::Init (G4double A, G4double Z, G4int M, G4Strin
if ( !dbool || ( Z<2.5 && ( std::abs(theNDLDataZ - Z)>0.0001 || std::abs(theNDLDataA - A)>0.0001)) )
{
#ifdef G4PHPDEBUG
if(getenv("G4ParticleHPDebug_NamesLogging")) G4cout << "Skipped = "<< filename <<" "<<A<<" "<<Z<<G4endl;
if(std::getenv("G4ParticleHPDebug_NamesLogging")) G4cout << "Skipped = "<< filename <<" "<<A<<" "<<Z<<G4endl;
#endif
hasAnyData = false;
hasFSData = false;
@@ -123,7 +126,9 @@ void G4ParticleHPInelasticBaseFS::Init (G4double A, G4double Z, G4int M, G4Strin
{
theData >> dataType;
if(dummy==INT_MAX) theData >> dummy >> dummy;
if(dummy==INT_MAX) theData >> Qvalue >> dummy;
Qvalue*=CLHEP::eV; //In G4NDL4.5 this value is the MT number (<1000), in others is que Q-value in eV
if(dataType==3)
{
G4int total;
@@ -158,7 +163,7 @@ void G4ParticleHPInelasticBaseFS::Init (G4double A, G4double Z, G4int M, G4Strin
else if(dataType==13)
{
theFinalStatePhotons = new G4ParticleHPPhotonDist;
theFinalStatePhotons->InitPartials(theData, theXsection);
theFinalStatePhotons->InitPartials(theData);
hasFSData = true;
}
else if(dataType==14)
@@ -242,9 +247,34 @@ void G4ParticleHPInelasticBaseFS::BaseApply(const G4HadProjectile & theTrack,
{
aPhaseMass+=theDefs[ii]->GetPDGMass();
}
//----------------------------------------------------------------------------
if(Qvalue<1.*CLHEP::keV && Qvalue>-1.*CLHEP::keV){ //Not in the G4NDL lib or not calculated yet:
//Calculate residual:
G4int ResidualA=theBaseA;
G4int ResidualZ=theBaseZ;
for (ii = 0; ii < nDef; ii++) {
ResidualZ -= theDefs[ii]->GetAtomicNumber();
ResidualA -= theDefs[ii]->GetBaryonNumber();
}
if (ResidualA > 0 && ResidualZ > 0) {
G4ParticleDefinition* resid = G4IonTable::GetIonTable()->GetIon(ResidualZ,ResidualA);
Qvalue = incidReactionProduct.GetMass()+theTarget.GetMass()-aPhaseMass-resid->GetPDGMass();
}
if (Qvalue > 400*CLHEP::MeV || Qvalue < -400*CLHEP::MeV) {
//Then Q value is probably too large ...
Qvalue = 1.1*CLHEP::keV;
}
}
//----------------------------------------------------------------------------
thePhaseSpaceDistribution.Init(aPhaseMass, nDef);
thePhaseSpaceDistribution.SetProjectileRP(&incidReactionProduct);
thePhaseSpaceDistribution.SetTarget(&theTarget);
thePhaseSpaceDistribution.SetQValue(Qvalue);
for(ii=0; ii<nDef; ii++)
{
G4double massCode = 1000.*std::abs(theDefs[ii]->GetPDGCharge());
@@ -258,7 +288,7 @@ void G4ParticleHPInelasticBaseFS::BaseApply(const G4HadProjectile & theTrack,
delete aSec;
theResult.Get()->AddSecondary(aPart);
#ifdef G4PHPDEBUG
if( getenv("G4ParticleHPDebug")) G4cout << this << " G4ParticleHPInelasticBaseFS::BaseApply NoFSData add secondary " << aPart->GetParticleDefinition()->GetParticleName() << " E= " << aPart->GetKineticEnergy() << " NSECO " << theResult.Get()->GetNumberOfSecondaries() << G4endl;
if( std::getenv("G4ParticleHPDebug")) G4cout << this << " G4ParticleHPInelasticBaseFS::BaseApply NoFSData add secondary " << aPart->GetParticleDefinition()->GetParticleName() << " E= " << aPart->GetKineticEnergy() << " NSECO " << theResult.Get()->GetNumberOfSecondaries() << G4endl;
#endif
}
theResult.Get()->SetStatusChange(stopAndKill);
@@ -297,7 +327,7 @@ void G4ParticleHPInelasticBaseFS::BaseApply(const G4HadProjectile & theTrack,
{
tmpHadrons = theEnergyAngData->Sample(eKinetic);
if ( !getenv( "G4PHP_DO_NOT_ADJUST_FINAL_STATE" ) ) {
if ( !std::getenv( "G4PHP_DO_NOT_ADJUST_FINAL_STATE" ) ) {
//141017 Fix BEGIN
//Adjust A and Z in the case of miss much between selected data and target nucleus
if ( tmpHadrons != NULL ) {
@@ -319,8 +349,10 @@ void G4ParticleHPInelasticBaseFS::BaseApply(const G4HadProjectile & theTrack,
if ( dA < 0 || dZ < 0 ) {
G4int newA = tmpHadrons->at(jAtMaxA)->GetDefinition()->GetBaryonNumber() + dA ;
G4int newZ = G4int( tmpHadrons->at(jAtMaxA)->GetDefinition()->GetPDGCharge() + eps ) + dZ;
G4ParticleDefinition* pd = G4IonTable::GetIonTable()->GetIon ( newZ , newA );
tmpHadrons->at( jAtMaxA )->SetDefinition( pd );
if(newA>newZ && newZ>0){
G4ParticleDefinition* pd = G4IonTable::GetIonTable()->GetIon ( newZ , newA );
tmpHadrons->at( jAtMaxA )->SetDefinition( pd );
}
}
}
//141017 Fix END
@@ -393,7 +425,7 @@ void G4ParticleHPInelasticBaseFS::BaseApply(const G4HadProjectile & theTrack,
G4double p1=std::sqrt(2.*mass2*emin);
bufferedDirection = p1*aHadron->GetMomentum().unit();
#ifdef G4PHPDEBUG
if(getenv("G4ParticleHPDebug")) // @@@@@ verify the nucleon counting...
if(std::getenv("G4ParticleHPDebug")) // @@@@@ verify the nucleon counting...
{
G4cout << "G4ParticleHPInelasticBaseFS "<<z1<<" "<<theBaseZ<<" "<<a1<<" "<<theBaseA<<" "<<availableEnergy<<" "
<< emin<<G4endl;
@@ -406,7 +438,7 @@ void G4ParticleHPInelasticBaseFS::BaseApply(const G4HadProjectile & theTrack,
}
// boost from cms to lab
#ifdef G4PHPDEBUG
if(getenv("G4ParticleHPDebug"))
if(std::getenv("G4ParticleHPDebug"))
{
G4cout << " G4ParticleHPInelasticBaseFS "<<bufferedDirection.mag2()<<G4endl;
}
@@ -416,7 +448,7 @@ void G4ParticleHPInelasticBaseFS::BaseApply(const G4HadProjectile & theTrack,
aHadron->SetMomentum(bufferedDirection);
aHadron->Lorentz(*aHadron, -1.*(theTarget+incidReactionProduct));
#ifdef G4PHPDEBUG
if(getenv("G4ParticleHPDebug"))
if(std::getenv("G4ParticleHPDebug"))
{
G4cout << " G4ParticleHPInelasticBaseFS "<<aHadron->GetTotalEnergy()<<" "<<aHadron->GetMomentum()<<G4endl;
}
@@ -424,7 +456,7 @@ void G4ParticleHPInelasticBaseFS::BaseApply(const G4HadProjectile & theTrack,
}
tmpHadrons->push_back(aHadron);
#ifdef G4PHPDEBUG
if( getenv("G4ParticleHPDebug")) G4cout << " G4ParticleHPInelasticBaseFS::BaseApply FSData add secondary " << aHadron->GetDefinition()->GetParticleName() << " E= " << aHadron->GetKineticEnergy() << G4endl;
if( std::getenv("G4ParticleHPDebug")) G4cout << " G4ParticleHPInelasticBaseFS::BaseApply FSData add secondary " << aHadron->GetDefinition()->GetParticleName() << " E= " << aHadron->GetKineticEnergy() << G4endl;
#endif
}
}
@@ -460,7 +492,7 @@ void G4ParticleHPInelasticBaseFS::BaseApply(const G4HadProjectile & theTrack,
#ifdef PHP_AS_HP
bAdjustPhotons = true;
#else
if ( getenv( "G4PHP_DO_NOT_ADJUST_FINAL_STATE" ) ) bAdjustPhotons = false;
if ( std::getenv( "G4PHP_DO_NOT_ADJUST_FINAL_STATE" ) ) bAdjustPhotons = false;
#endif
if( bAdjustPhotons ) {
@@ -508,7 +540,7 @@ void G4ParticleHPInelasticBaseFS::BaseApply(const G4HadProjectile & theTrack,
theGammaEnergy += eBindProducts;
#ifdef G4PHPDEBUG
if( getenv("G4ParticleHPDebug")) G4cout << " G4ParticleHPInelasticBaseFS::BaseApply gamma Energy " << theGammaEnergy << " eBindProducts " << eBindProducts << G4endl;
if( std::getenv("G4ParticleHPDebug")) G4cout << " G4ParticleHPInelasticBaseFS::BaseApply gamma Energy " << theGammaEnergy << " eBindProducts " << eBindProducts << G4endl;
#endif
//101111
@@ -537,7 +569,7 @@ void G4ParticleHPInelasticBaseFS::BaseApply(const G4HadProjectile & theTrack,
{
theOtherPhotons = theGammas.GetDecayGammas(iLevel);
#ifdef G4PHPDEBUG
if( getenv("G4ParticleHPDebug")) G4cout << " G4ParticleHPInelasticBaseFS::BaseApply adding gamma from level " << iLevel << theOtherPhotons->operator[](ii)->GetKineticEnergy() << G4endl;
if( std::getenv("G4ParticleHPDebug")) G4cout << " G4ParticleHPInelasticBaseFS::BaseApply adding gamma from level " << iLevel << theOtherPhotons->operator[](ii)->GetKineticEnergy() << G4endl;
#endif
}
else
@@ -555,7 +587,7 @@ void G4ParticleHPInelasticBaseFS::BaseApply(const G4HadProjectile & theTrack,
{
thePhotons->push_back(theOtherPhotons->operator[](iii));
#ifdef G4PHPDEBUG
if( getenv("G4ParticleHPDebug"))
if( std::getenv("G4ParticleHPDebug"))
G4cout << iii << " G4ParticleHPInelasticBaseFS::BaseApply adding gamma " << theOtherPhotons->operator[](iii)->GetKineticEnergy() << G4endl;
#endif
}
@@ -574,7 +606,7 @@ void G4ParticleHPInelasticBaseFS::BaseApply(const G4HadProjectile & theTrack,
nSecondaries += nPhotons;
G4DynamicParticle * theSec;
#ifdef G4PHPDEBUG
if( getenv("G4ParticleHPDebug")) G4cout << " G4ParticleHPInelasticBaseFS::BaseApply N hadrons " << nSecondaries-nPhotons << G4endl;
if( std::getenv("G4ParticleHPDebug")) G4cout << " G4ParticleHPInelasticBaseFS::BaseApply N hadrons " << nSecondaries-nPhotons << G4endl;
#endif
for(i=0; i<nSecondaries-nPhotons; i++)
@@ -584,13 +616,13 @@ void G4ParticleHPInelasticBaseFS::BaseApply(const G4HadProjectile & theTrack,
theSec->SetMomentum(tmpHadrons->operator[](i)->GetMomentum());
theResult.Get()->AddSecondary(theSec);
#ifdef G4PHPDEBUG
if( getenv("G4ParticleHPDebug")) G4cout << this << " G4ParticleHPInelasticBaseFS::BaseApply add secondary2 " << theSec->GetParticleDefinition()->GetParticleName() << " E= " << theSec->GetKineticEnergy() << " NSECO " << theResult.Get()->GetNumberOfSecondaries() << G4endl;
if( std::getenv("G4ParticleHPDebug")) G4cout << this << " G4ParticleHPInelasticBaseFS::BaseApply add secondary2 " << theSec->GetParticleDefinition()->GetParticleName() << " E= " << theSec->GetKineticEnergy() << " NSECO " << theResult.Get()->GetNumberOfSecondaries() << G4endl;
#endif
if( getenv("G4PHPTEST") ) G4cout << " InelasticBaseFS COS THETA " << std::cos(theSec->GetMomentum().theta()) << " " << (theSec->GetMomentum().theta()) << " " << theSec->GetMomentum() << " E "<< theSec->GetKineticEnergy() << " " << theSec->GetDefinition()->GetParticleName() << G4endl; //GDEB
if( std::getenv("G4PHPTEST") ) G4cout << " InelasticBaseFS COS THETA " << std::cos(theSec->GetMomentum().theta()) << " " << (theSec->GetMomentum().theta()) << " " << theSec->GetMomentum() << " E "<< theSec->GetKineticEnergy() << " " << theSec->GetDefinition()->GetParticleName() << G4endl; //GDEB
delete tmpHadrons->operator[](i);
}
#ifdef G4PHPDEBUG
if( getenv("G4ParticleHPDebug")) G4cout << " G4ParticleHPInelasticBaseFS::BaseApply N photons " << nPhotons << G4endl;
if( std::getenv("G4ParticleHPDebug")) G4cout << " G4ParticleHPInelasticBaseFS::BaseApply N photons " << nPhotons << G4endl;
#endif
if(thePhotons != 0)
{
@@ -601,7 +633,7 @@ void G4ParticleHPInelasticBaseFS::BaseApply(const G4HadProjectile & theTrack,
theSec->SetMomentum(thePhotons->operator[](i)->GetMomentum());
theResult.Get()->AddSecondary(theSec);
#ifdef G4PHPDEBUG
if( getenv("G4ParticleHPDebug")) G4cout << this << " G4ParticleHPInelasticBaseFS::BaseApply add secondary3 " << theSec->GetParticleDefinition()->GetParticleName() << " E= " << theSec->GetKineticEnergy() << " NSECO " << theResult.Get()->GetNumberOfSecondaries() << G4endl;
if( std::getenv("G4ParticleHPDebug")) G4cout << this << " G4ParticleHPInelasticBaseFS::BaseApply add secondary3 " << theSec->GetParticleDefinition()->GetParticleName() << " E= " << theSec->GetKineticEnergy() << " NSECO " << theResult.Get()->GetNumberOfSecondaries() << G4endl;
#endif
delete thePhotons->operator[](i);
}
@@ -616,7 +648,9 @@ void G4ParticleHPInelasticBaseFS::BaseApply(const G4HadProjectile & theTrack,
G4LorentzVector targ_4p_lab ( theTarget.GetMomentum() , std::sqrt( targ_pd->GetPDGMass()*targ_pd->GetPDGMass() + theTarget.GetMomentum().mag2() ) );
G4LorentzVector proj_4p_lab = theTrack.Get4Momentum();
G4LorentzVector init_4p_lab = proj_4p_lab + targ_4p_lab;
adjust_final_state ( init_4p_lab );
//if data in MF=6 format (no correlated particle emission), then adjust_final_state can give severe errors:
if(theEnergyAngData==0){adjust_final_state ( init_4p_lab );}
// clean up the primary neutron
theResult.Get()->SetStatusChange(stopAndKill);
@@ -55,9 +55,12 @@
#include "G4ParticleHPDataUsed.hh"
#include "G4IonTable.hh"
#include "G4Pow.hh"
#include "G4SystemOfUnits.hh"
#include "G4NRESP71M03.hh" // nresp71_m03.hh and nresp71_m02.hh are alike. The only difference between m02 and m03 is in the total carbon cross section that is properly included in the latter. These data are not used in nresp71_m0*.hh.
// June-2019 - E. Mendoza - re-build "two_body_reaction", to be used by incident charged particles (now isotropic emission in the CMS). Also restrict nresp use below 20 MeV (for future developments). Add photon emission when no data available.
void G4ParticleHPInelasticCompFS::InitGammas(G4double AR, G4double ZR)
{
// char the[100] = {""};
@@ -83,16 +86,16 @@ void G4ParticleHPInelasticCompFS::InitGammas(G4double AR, G4double ZR)
void G4ParticleHPInelasticCompFS::Init (G4double A, G4double Z, G4int M, G4String & dirName, G4String & aFSType, G4ParticleDefinition*)
{
gammaPath = "/Inelastic/Gammas/"; //only in neutron data base
if(!getenv("G4NEUTRONHPDATA"))
if(!std::getenv("G4NEUTRONHPDATA"))
throw G4HadronicException(__FILE__, __LINE__, "Please setenv G4NEUTRONHPDATA to point to the neutron cross-section files where Inelastic/Gammas data is found.");
G4String tBase = getenv("G4NEUTRONHPDATA");
G4String tBase = std::getenv("G4NEUTRONHPDATA");
gammaPath = tBase+gammaPath;
G4String tString = dirName;
G4bool dbool;
G4ParticleHPDataUsed aFile = theNames.GetName(static_cast<G4int>(A), static_cast<G4int>(Z), M, tString, aFSType, dbool);
G4String filename = aFile.GetName();
#ifdef G4PHPDEBUG
if( getenv("G4ParticleHPDebug") ) G4cout << " G4ParticleHPInelasticCompFS::Init FILE " << filename << G4endl;
if( std::getenv("G4ParticleHPDebug") ) G4cout << " G4ParticleHPInelasticCompFS::Init FILE " << filename << G4endl;
#endif
SetAZMs( A, Z, M, aFile );
@@ -104,7 +107,7 @@ void G4ParticleHPInelasticCompFS::Init (G4double A, G4double Z, G4int M, G4Strin
if ( !dbool || ( Z<2.5 && ( std::abs(theNDLDataZ - Z)>0.0001 || std::abs(theNDLDataA - A)>0.0001)) )
{
#ifdef G4PHPDEBUG
if(getenv("G4ParticleHPDebug_NamesLogging")) G4cout << "Skipped = "<< filename <<" "<<A<<" "<<Z<<G4endl;
if(std::getenv("G4ParticleHPDebug_NamesLogging")) G4cout << "Skipped = "<< filename <<" "<<A<<" "<<Z<<G4endl;
#endif
hasAnyData = false;
hasFSData = false;
@@ -176,7 +179,7 @@ void G4ParticleHPInelasticCompFS::Init (G4double A, G4double Z, G4int M, G4Strin
else if(dataType==13)
{
theFinalStatePhotons[it] = new G4ParticleHPPhotonDist;
theFinalStatePhotons[it]->InitPartials(theData, theXsection[50]);
theFinalStatePhotons[it]->InitPartials(theData);
}
else if(dataType==14)
{
@@ -251,7 +254,7 @@ void G4ParticleHPInelasticCompFS::CompositeApply(const G4HadProjectile& theTrack
G4double eps = 0.0001;
targetMass = G4NucleiProperties::GetNuclearMass(static_cast<G4int>(theBaseA+eps), static_cast<G4int>(theBaseZ+eps));
#ifdef G4PHPDEBUG
if( getenv("G4ParticleHPDebug")) G4cout <<this <<" G4ParticleHPInelasticCompFS::CompositeApply A " <<theBaseA <<" Z " <<theBaseZ <<" incident " <<hadProjectile->GetDefinition()->GetParticleName() <<G4endl;
if( std::getenv("G4ParticleHPDebug")) G4cout <<this <<" G4ParticleHPInelasticCompFS::CompositeApply A " <<theBaseA <<" Z " <<theBaseZ <<" incident " <<hadProjectile->GetDefinition()->GetParticleName() <<G4endl;
#endif
// if(theEnergyAngData[i]!=0)
// targetMass = theEnergyAngData[i]->GetTargetMass();
@@ -284,13 +287,20 @@ void G4ParticleHPInelasticCompFS::CompositeApply(const G4HadProjectile& theTrack
// select exit channel for composite FS class.
G4int it = SelectExitChannel( eKinetic );
// set target and neutron in the relevant exit channel
//E. Mendoza (2018) -- to use JENDL/AN-2005
if(theEnergyDistribution[it]==0 && theAngularDistribution[it]==0 && theEnergyAngData[it]==0){
if(theEnergyDistribution[50]!=0 || theAngularDistribution[50]!=0 || theEnergyAngData[50]!=0){
it=50;
}
}
// set target and neutron in the relevant exit channel
InitDistributionInitialState(incidReactionProduct, theTarget, it);
//---------------------------------------------------------------------//
//Hook for NRESP71MODEL
if ( G4ParticleHPManager::GetInstance()->GetUseNRESP71Model() ) {
if ( G4ParticleHPManager::GetInstance()->GetUseNRESP71Model() && eKinetic<20*MeV) {
if ( (G4int)(theBaseZ+0.1) == 6 ) // If the reaction is with Carbon...
{
if ( theProjectile == G4Neutron::Definition() ) {
@@ -396,48 +406,50 @@ void G4ParticleHPInelasticCompFS::CompositeApply(const G4HadProjectile& theTrack
G4double dqi = QI[it];
if ( dqi < 0 || 849 < dqi ) useQI = true; //Former libraies does not have values of this range
if (useQI) {
// QI introudced since G4NDL3.15
eExcitation = -QI[it];
//Re-evluate iLevel based on this eExcitation
iLevel = 0;
G4bool find = false;
G4int imaxEx = 0;
G4double level_tolerance = 1.0*CLHEP::keV;
if ( useQI )
{
// QI introudced since G4NDL3.15
G4double QM=(incidReactionProduct.GetMass()+targetMass)-(aHadron.GetMass()+residualMass);
eExcitation = QM-QI[it];
if(eExcitation<20*CLHEP::keV){eExcitation=0;}
while (theGammas.GetLevel(iLevel+1) != 0) // Loop checking, 11.05.2015, T. Koi
{
G4double maxEx = 0.0;
if (maxEx < theGammas.GetLevel(iLevel)->GetLevelEnergy() ) {
maxEx = theGammas.GetLevel(iLevel)->GetLevelEnergy();
imaxEx = iLevel;
}
//Re-evluate iLevel based on this eExcitation
iLevel = 0;
G4bool find = false;
G4int imaxEx = 0;
G4double level_tolerance = 1.0*CLHEP::keV;
// Fix bug 1789 DHW - first if-branch added because gamma data come from ENSDF
// and do not necessarily match the excitations used in ENDF-B.VII
// Compromise solution: use 1 keV tolerance suggested by T. Koi
if (std::abs(eExcitation - theGammas.GetLevel(iLevel)->GetLevelEnergy() ) < level_tolerance) {
find = true;
break;
while( theGammas.GetLevel(iLevel+1) != 0 ) // Loop checking, 11.05.2015, T. Koi
{
G4double maxEx = 0.0;
if ( maxEx < theGammas.GetLevel(iLevel)->GetLevelEnergy() )
{
maxEx = theGammas.GetLevel(iLevel)->GetLevelEnergy();
imaxEx = iLevel;
}
} else if (eExcitation < theGammas.GetLevel(iLevel)->GetLevelEnergy() ) {
find = true;
iLevel--;
// very small eExcitation, iLevel becomes -1, this is protected below.
// Fix bug 1838 DHW - only reset iLevel when incoming and outgoing particles are the same
if (theTrack.GetDefinition() == aDefinition) {
if (iLevel == -1) iLevel = 0;
}
break;
}
iLevel++;
}
// If proper level cannot be found, use the maximum level
if ( !find ) iLevel = imaxEx;
// Fix bug 1789 DHW - first if-branch added because gamma data come from ENSDF
// and do not necessarily match the excitations used in ENDF-B.VII
// Compromise solution: use 1 keV tolerance suggested by T. Koi
if (std::abs(eExcitation - theGammas.GetLevel(iLevel)->GetLevelEnergy() ) < level_tolerance) {
find = true;
break;
} else if (eExcitation < theGammas.GetLevel(iLevel)->GetLevelEnergy() ) {
find = true;
iLevel--;
// very small eExcitation, iLevel becomes -1, this is protected below.
if ( iLevel == -1 ) iLevel = 0; // But cause energy trouble.
break;
}
iLevel++;
}
// In case, cannot find proper level, then use the maximum level.
if ( !find ) iLevel = imaxEx;
}
//110610TK END
if(getenv("G4ParticleHPDebug") && eKinetic-eExcitation < 0)
if(std::getenv("G4ParticleHPDebug") && eKinetic-eExcitation < 0)
{
throw G4HadronicException(__FILE__, __LINE__, "SEVERE: InelasticCompFS: Consistency of data not good enough, please file report");
}
@@ -582,24 +594,25 @@ void G4ParticleHPInelasticCompFS::CompositeApply(const G4HadProjectile& theTrack
//G4cout << "nothingWasKnownOnHadron " << nothingWasKnownOnHadron << G4endl;
if(nothingWasKnownOnHadron)
{
// TKDB 100405
// In this case, hadron should be isotropic in CM
// Next 12 lines are Emilio's replacement
G4double QM=(incidReactionProduct.GetMass()+targetMass)-(aHadron.GetMass()+residualMass);
G4double eExcitation = QM-QI[it];
if(eExcitation<20*CLHEP::keV){eExcitation=0;}
two_body_reaction(&incidReactionProduct,&theTarget,&aHadron,eExcitation);
if(thePhotons==0 && eExcitation>0){
for(iLevel=theGammas.GetNumberOfLevels()-1; iLevel>=0; iLevel--)
{
if(theGammas.GetLevelEnergy(iLevel)<eExcitation+5*keV) break; // 5 keV tolerance
}
thePhotons = theGammas.GetDecayGammas(iLevel);
}
}
// Emilio's replacement done
/*
// This code replaced by Emilio (previous 12 lines)
// mu and p should be correlated
//
// Following lines made obsolete by fix to bug 2166 (A. Zontikov)
/*
G4double totalPhotonEnergy = 0.0;
if ( thePhotons != 0 )
{
unsigned int nPhotons = thePhotons->size();
unsigned int ii0;
for ( ii0=0; ii0<nPhotons; ii0++)
{
//thePhotons has energies at LAB system
totalPhotonEnergy += thePhotons->operator[](ii0)->GetTotalEnergy();
}
}
*/
//isotropic distribution in CM
G4double mu = 1.0 - 2.*G4UniformRand();
@@ -629,38 +642,8 @@ void G4ParticleHPInelasticCompFS::CompositeApply(const G4HadProjectile& theTrack
delete targ;
delete hadron;
//TKDB 100405
/*
G4double totalPhotonEnergy = 0;
if(thePhotons!=0)
{
unsigned int nPhotons = thePhotons->size();
unsigned int i0;
for(i0=0; i0<nPhotons; i0++)
{
totalPhotonEnergy += thePhotons->operator[](i0)->GetTotalEnergy();
}
}
availableEnergy -= totalPhotonEnergy;
residualMass += totalPhotonEnergy/theProjectile->GetPDGMass();
aHadron.SetKineticEnergy(availableEnergy*residualMass*theProjectile->GetPDGMass()/
(aHadron.GetMass()+residualMass*theProjectile->GetPDGMass()));
G4double CosTheta = 1.0 - 2.0*G4UniformRand();
G4double SinTheta = std::sqrt(1.0 - CosTheta*CosTheta);
G4double Phi = twopi*G4UniformRand();
G4ThreeVector Vector(std::cos(Phi)*SinTheta, std::sin(Phi)*SinTheta, CosTheta);
//aHadron.SetMomentum(Vector* std::sqrt(aHadron.GetTotalEnergy()*aHadron.GetTotalEnergy()-
// aHadron.GetMass()*aHadron.GetMass()));
G4double p2 = aHadron.GetTotalEnergy()*aHadron.GetTotalEnergy()- aHadron.GetMass()*aHadron.GetMass();
G4double p = 0.0;
if ( p2 > 0.0 )
p = std::sqrt ( p2 );
aHadron.SetMomentum( Vector*p );
*/
}
*/
// fill the result
// Beware - the recoil is not necessarily in the particles...
@@ -711,7 +694,7 @@ void G4ParticleHPInelasticCompFS::CompositeApply(const G4HadProjectile& theTrack
theSec->SetMomentum(aHadron.GetMomentum());
theResult.Get()->AddSecondary(theSec);
#ifdef G4PHPDEBUG
if( getenv("G4ParticleHPDebug")) G4cout << this << " G4ParticleHPInelasticCompFS::BaseApply add secondary1 " << theSec->GetParticleDefinition()->GetParticleName() << " E= " << theSec->GetKineticEnergy() << " NSECO " << theResult.Get()->GetNumberOfSecondaries() << G4endl;
if( std::getenv("G4ParticleHPDebug")) G4cout << this << " G4ParticleHPInelasticCompFS::BaseApply add secondary1 " << theSec->GetParticleDefinition()->GetParticleName() << " E= " << theSec->GetKineticEnergy() << " NSECO " << theResult.Get()->GetNumberOfSecondaries() << G4endl;
#endif
aHadron.Lorentz(aHadron, theTarget);
@@ -739,7 +722,7 @@ void G4ParticleHPInelasticCompFS::CompositeApply(const G4HadProjectile& theTrack
theSec->SetMomentum(theResidual.GetMomentum()-totalPhotonMomentum);
theResult.Get()->AddSecondary(theSec);
#ifdef G4PHPDEBUG
if( getenv("G4ParticleHPDebug")) G4cout << this << " G4ParticleHPInelasticCompFS::BaseApply add secondary2 " << theSec->GetParticleDefinition()->GetParticleName() << " E= " << theSec->GetKineticEnergy() << " NSECO " << theResult.Get()->GetNumberOfSecondaries() << G4endl;
if( std::getenv("G4ParticleHPDebug")) G4cout << this << " G4ParticleHPInelasticCompFS::BaseApply add secondary2 " << theSec->GetParticleDefinition()->GetParticleName() << " E= " << theSec->GetKineticEnergy() << " NSECO " << theResult.Get()->GetNumberOfSecondaries() << G4endl;
#endif
}
else
@@ -751,7 +734,7 @@ void G4ParticleHPInelasticCompFS::CompositeApply(const G4HadProjectile& theTrack
theSec->SetMomentum(theParticles->operator[](i0)->GetMomentum());
theResult.Get()->AddSecondary(theSec);
#ifdef G4PHPDEBUG
if( getenv("G4ParticleHPDebug")) G4cout << this << " G4ParticleHPInelasticCompFS::BaseApply add secondary3 " << theSec->GetParticleDefinition()->GetParticleName() << " E= " << theSec->GetKineticEnergy() << " NSECO " << theResult.Get()->GetNumberOfSecondaries() << G4endl;
if( std::getenv("G4ParticleHPDebug")) G4cout << this << " G4ParticleHPInelasticCompFS::BaseApply add secondary3 " << theSec->GetParticleDefinition()->GetParticleName() << " E= " << theSec->GetKineticEnergy() << " NSECO " << theResult.Get()->GetNumberOfSecondaries() << G4endl;
#endif
delete theParticles->operator[](i0);
}
@@ -779,7 +762,7 @@ void G4ParticleHPInelasticCompFS::CompositeApply(const G4HadProjectile& theTrack
theSec->SetMomentum(theResidual.GetMomentum());
theResult.Get()->AddSecondary(theSec);
#ifdef G4PHPDEBUG
if( getenv("G4ParticleHPDebug")) G4cout << this << " G4ParticleHPInelasticCompFS::BaseApply add secondary4 " << theSec->GetParticleDefinition()->GetParticleName() << " E= " << theSec->GetKineticEnergy() << " NSECO " << theResult.Get()->GetNumberOfSecondaries() << G4endl;
if( std::getenv("G4ParticleHPDebug")) G4cout << this << " G4ParticleHPInelasticCompFS::BaseApply add secondary4 " << theSec->GetParticleDefinition()->GetParticleName() << " E= " << theSec->GetKineticEnergy() << " NSECO " << theResult.Get()->GetNumberOfSecondaries() << G4endl;
#endif
}
@@ -796,7 +779,7 @@ void G4ParticleHPInelasticCompFS::CompositeApply(const G4HadProjectile& theTrack
theSec->SetMomentum(thePhotons->operator[](i)->GetMomentum());
theResult.Get()->AddSecondary(theSec);
#ifdef G4PHPDEBUG
if( getenv("G4ParticleHPDebug")) G4cout << this << " G4ParticleHPInelasticCompFS::BaseApply add secondary5 " << theSec->GetParticleDefinition()->GetParticleName() << " E= " << theSec->GetKineticEnergy() << " NSECO " << theResult.Get()->GetNumberOfSecondaries() << G4endl;
if( std::getenv("G4ParticleHPDebug")) G4cout << this << " G4ParticleHPInelasticCompFS::BaseApply add secondary5 " << theSec->GetParticleDefinition()->GetParticleName() << " E= " << theSec->GetKineticEnergy() << " NSECO " << theResult.Get()->GetNumberOfSecondaries() << G4endl;
#endif
delete thePhotons->operator[](i);
@@ -818,94 +801,54 @@ void G4ParticleHPInelasticCompFS::CompositeApply(const G4HadProjectile& theTrack
#include "G4RotationMatrix.hh"
void G4ParticleHPInelasticCompFS::two_body_reaction ( G4DynamicParticle* proj, G4DynamicParticle* targ, G4DynamicParticle* hadron, G4double mu )
//Re-implemented by E. Mendoza (2019). Isotropic emission in the CMS:
// proj: projectile in target-rest-frame (input)
// targ: target in target-rest-frame (input)
// product: secondary particle in target-rest-frame (output)
// resExcitationEnergy: excitation energy of the residual nucleus
void G4ParticleHPInelasticCompFS::two_body_reaction(G4ReactionProduct* proj,
G4ReactionProduct* targ,
G4ReactionProduct* product,
G4double resExcitationEnergy)
{
//CMS system:
G4ReactionProduct theCMS= *proj+ *targ;
// Target rest flame
// 4vector in targ rest frame;
// targ could have excitation energy (photon energy will be emiited) tricky but,,,
//Residual definition:
G4int resZ=(G4int)(proj->GetDefinition()->GetPDGCharge()+targ->GetDefinition()->GetPDGCharge()-product->GetDefinition()->GetPDGCharge()+0.1);
G4int resA=proj->GetDefinition()->GetBaryonNumber()+targ->GetDefinition()->GetBaryonNumber()-product->GetDefinition()->GetBaryonNumber();
G4ReactionProduct theResidual;
theResidual.SetDefinition(G4IonTable::GetIonTable()->GetIon(resZ,resA,0.0));
G4LorentzVector before = proj->Get4Momentum() + targ->Get4Momentum();
//CMS system:
G4ReactionProduct theCMSproj;
G4ReactionProduct theCMStarg;
theCMSproj.Lorentz(*proj,theCMS);
theCMStarg.Lorentz(*targ,theCMS);
//final Momentum in the CMS:
G4double totE=std::sqrt(theCMSproj.GetMass()*theCMSproj.GetMass()+theCMSproj.GetTotalMomentum()*theCMSproj.GetTotalMomentum())+std::sqrt(theCMStarg.GetMass()*theCMStarg.GetMass()+theCMStarg.GetTotalMomentum()*theCMStarg.GetTotalMomentum());
G4double prodmass=product->GetMass();
G4double resmass=theResidual.GetMass()+resExcitationEnergy;
G4double fmomsquared=1./4./totE/totE*(totE*totE-(prodmass-resmass)*(prodmass-resmass))*(totE*totE-(prodmass+resmass)*(prodmass+resmass));
G4double fmom=0;
if(fmomsquared>0){
fmom=std::sqrt(fmomsquared);
}
G4ThreeVector p3_proj = proj->GetMomentum();
G4ThreeVector d = p3_proj.unit();
G4RotationMatrix rot;
G4RotationMatrix rot1;
rot1.setPhi( CLHEP::pi/2 + d.phi() );
G4RotationMatrix rot2;
rot2.setTheta( d.theta() );
rot=rot2*rot1;
proj->SetMomentum( rot*p3_proj );
// Now proj only has pz component;
// mu in CM system
//Valid only for neutron incidence
G4DynamicParticle* residual = new G4DynamicParticle ( G4IonTable::GetIonTable()->GetIon ( (G4int)( targ->GetDefinition()->GetPDGCharge() - hadron->GetDefinition()->GetPDGCharge() ) , (G4int)(targ->GetDefinition()->GetBaryonNumber() - hadron->GetDefinition()->GetBaryonNumber()+1) , 0 ) , G4ThreeVector(0) );
G4double Q = proj->GetDefinition()->GetPDGMass() + targ->GetDefinition()->GetPDGMass()
- ( hadron->GetDefinition()->GetPDGMass() + residual->GetDefinition()->GetPDGMass() );
// Non Relativistic Case
G4double A = targ->GetDefinition()->GetPDGMass() / proj->GetDefinition()->GetPDGMass();
G4double AA = hadron->GetDefinition()->GetPDGMass() / proj->GetDefinition()->GetPDGMass();
G4double E1 = proj->GetKineticEnergy();
// 101111
// In _nat_ data (Q+E1) could become negative value, following line is safty for this case.
//if ( (Q+E1) < 0 )
if ( ( 1 + (1+A)/A*Q/E1 ) < 0 )
{
// 1.0e-6 eV is additional safty for numeric precision
Q = -( A/(1+A)*E1 ) + 1.0e-6*CLHEP::eV;
}
G4double beta = std::sqrt ( A*(A+1-AA)/AA*( 1 + (1+A)/A*Q/E1 ) );
G4double gamma = AA/(A+1-AA)*beta;
G4double E3 = AA/G4Pow::GetInstance()->powN((1+A),2)*(beta*beta+1+2*beta*mu)*E1;
G4double omega3 = (1+beta*mu)/std::sqrt(beta*beta+1+2*beta*mu);
if ( omega3 > 1.0 ) omega3 = 1.0;
G4double E4 = (A+1-AA)/G4Pow::GetInstance()->powN((1+A),2)*(gamma*gamma+1-2*gamma*mu)*E1;
G4double omega4 = (1-gamma*mu)/std::sqrt(gamma*gamma+1-2*gamma*mu);
if ( omega4 > 1.0 ) omega4 = 1.0;
hadron->SetKineticEnergy ( E3 );
G4double M = hadron->GetDefinition()->GetPDGMass();
G4double pmag = std::sqrt ((E3+M)*(E3+M)-M*M) ;
G4ThreeVector p ( 0 , pmag*std::sqrt(1-omega3*omega3), pmag*omega3 );
G4double M4 = residual->GetDefinition()->GetPDGMass();
G4double pmag4 = std::sqrt ((E4+M4)*(E4+M4)-M4*M4) ;
G4ThreeVector p4 ( 0 , -pmag4*std::sqrt(1-omega4*omega4), pmag4*omega4 );
// Rotate to orginal target rest flame.
p *= rot.inverse();
hadron->SetMomentum( p );
// Now hadron had 4 momentum in target rest flame
// TypeA
p4 *= rot.inverse();
residual->SetMomentum ( p4 );
//TypeB1
//residual->Set4Momentum ( p4_residual );
//TypeB2
//residual->SetMomentum ( p4_residual.v() );
// Type A make difference in Momenutum
// Type B1 make difference in Mass of residual
// Type B2 make difference in total energy.
delete residual;
//random (isotropic direction):
G4double cosTh = 2.*G4UniformRand()-1.;
G4double phi = CLHEP::twopi*G4UniformRand();
G4double theta = std::acos(cosTh);
G4double sinth = std::sin(theta);
product->SetMomentum(fmom*sinth*std::cos(phi),fmom*sinth*std::sin(phi),fmom*cosTh); //CMS
product->SetTotalEnergy(std::sqrt(prodmass*prodmass+fmom*fmom)); //CMS
//Back to the LAB system:
product->Lorentz(*product,-1.*theCMS);
}
G4bool G4ParticleHPInelasticCompFS::use_nresp71_model( const G4ParticleDefinition* aDefinition , const G4int it , const G4ReactionProduct& theTarget , G4ReactionProduct& boosted )
{
if ( aDefinition == G4Neutron::Definition() ) // If the outgoing particle is a neutron...
@@ -74,16 +74,16 @@ G4ParticleHPInelasticData::G4ParticleHPInelasticData(G4ParticleDefinition* proje
dataName.at(0) = toupper(dataName.at(0)) ;
SetName( dataName );
if ( !getenv(dataDirVariable) && !getenv( "G4PARTICLEHPDATA" ) ){
if ( !std::getenv(dataDirVariable) && !std::getenv( "G4PARTICLEHPDATA" ) ){
G4String message("Please setenv " + G4String(dataDirVariable) + " to point to the " + projectile->GetParticleName() + " cross-section files.");
throw G4HadronicException(__FILE__, __LINE__,message.c_str());
}
G4String dirName;
if ( getenv(dataDirVariable) ) {
dirName = getenv(dataDirVariable);
if ( std::getenv(dataDirVariable) ) {
dirName = std::getenv(dataDirVariable);
} else {
G4String baseName = getenv( "G4PARTICLEHPDATA" );
G4String baseName = std::getenv( "G4PARTICLEHPDATA" );
dirName = baseName + "/" + particleName;
}
G4cout << "@@@ G4ParticleHPInelasticData instantiated for particle " << projectile->GetParticleName() << " data directory variable is " << dataDirVariable << " pointing to " << dirName << G4endl;
@@ -51,12 +51,12 @@ G4bool G4ParticleHPIsoData::Init(G4int A, G4int Z, G4int M, G4double abun, G4Str
G4ParticleHPManager::GetInstance()->GetDataStream(filename,theChannel);
#ifdef G4PHPDEBUG
if(getenv("G4ParticleHPDebug")) G4cout << "G4ParticleHPIsoData::Init = "<< filename <<" "<< A << " " << Z <<G4endl;
if(std::getenv("G4ParticleHPDebug")) G4cout << "G4ParticleHPIsoData::Init = "<< filename <<" "<< A << " " << Z <<G4endl;
#endif
if(Z==1 && (aFile.GetZ()!=Z || std::abs(aFile.GetA()-A)>0.0001) )
{
if(getenv("G4ParticleHPDebug")) G4cout << "Skipped = "<< filename <<" "<<A<<" "<<Z<<G4endl;
if(std::getenv("G4ParticleHPDebug")) G4cout << "Skipped = "<< filename <<" "<<A<<" "<<Z<<G4endl;
//080901 TKDB No more necessary below protection, cross sections set to 0 in G4ParticleHPNames
//And below two lines causes trouble with G4PhysicsVector
//theChannel.close();
@@ -109,10 +109,10 @@ void G4ParticleHPIsoData::Init(G4int A, G4int Z, G4int M,G4double abun, G4Partic
}
G4String baseName;
if ( getenv( dataDirVariable ) ) {
baseName = getenv( dataDirVariable );
if ( std::getenv( dataDirVariable ) ) {
baseName = std::getenv( dataDirVariable );
} else {
baseName = getenv( "G4PARTICLEHPDATA" );
baseName = std::getenv( "G4PARTICLEHPDATA" );
baseName += "/" + particleName;
}
@@ -104,7 +104,7 @@ void G4ParticleHPJENDLHEData::BuildPhysicsTable( const G4ParticleDefinition& aP
// throw G4HadronicException(__FILE__, __LINE__, "Attempt to use NeutronHP data for particles other than neutrons!!!");
particleName = aP.GetParticleName();
G4String baseName = getenv( "G4NEUTRONHPDATA" );
G4String baseName = std::getenv( "G4NEUTRONHPDATA" );
G4String dirName = baseName+"/JENDL_HE/"+particleName+"/"+reactionName ;
G4String aFSType = "/CrossSection/";
G4ParticleHPNames theNames;
@@ -31,6 +31,8 @@
//
// P. Arce, June-2014 Conversion neutron_hp to particle_hp
//
// June-2019 - E. Mendoza --> perform some corrections
#include "G4ParticleHPKallbachMannSyst.hh"
#include "G4SystemOfUnits.hh"
#include "Randomize.hh"
@@ -76,10 +78,8 @@ G4double G4ParticleHPKallbachMannSyst::Kallbach(G4double cosTh, G4double anEnerg
// Kallbach-Mann systematics without normalization.
G4double result;
G4double theX = A(anEnergy)*cosTh;
// We need to use here std::exp (and not G4Exp) to avoid underflow/overflow problems
// (observed with the physics list QGSP_BIC_AllHP in the version G4 10.5).
result = 0.5*(std::exp( theX)*(1+theCompoundFraction)
+std::exp(-theX)*(1-theCompoundFraction));
result = 0.5*(G4Exp( theX)*(1+theCompoundFraction)
+G4Exp(-theX)*(1-theCompoundFraction));
return result;
}
@@ -104,69 +104,60 @@ G4double G4ParticleHPKallbachMannSyst::A(G4double anEnergy)
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 = std::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 = std::min(ea, Et3);
G4double epsa = anEnergy*theTargetMass/(theTargetMass+theIncidentMass);
G4int Ac = theTargetA+theProjectileA;
G4int Nc = Ac - theTargetZ-theProjectileZ;
G4int AA = theTargetA;
G4int ZA = theTargetZ;
G4double ea = epsa+SeparationEnergy(Ac, Nc, AA, ZA,theProjectileA,theProjectileZ);
G4double Et1 = 130*MeV;
G4double R1 = std::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,theProductA, theProductZ);
G4double X1 = R1*eb/ea;
G4double Et3 = 41*MeV;
G4double R3 = std::min(ea, Et3);
G4double X3 = R3*eb/ea;
G4double Ma = 1;
G4double mb(0);
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;
}
G4double Ma=1;
G4double mb=1;
if(theProjectileA==1 || (theProjectileZ==1 && theProjectileA==2)){Ma=1;}//neutron,proton,deuteron
else if(theProjectileA==4 && theProjectileZ==2){Ma=0;}//alpha
else if(theProjectileA==3 && (theProjectileZ==1 || theProjectileZ==2)){Ma=0.5;}//tritum,He3 : set intermediate value
else
{
throw G4HadronicException(__FILE__, __LINE__, "Severe error in the sampling of Kallbach-Mann Systematics");
}
if(theProductA==1 && theProductZ==0){mb=1./2.;}//neutron
else if(theProductA==4 && theProductZ==2){mb=2;}//alpha
else{mb=1;}
result = C1*X1 + C2*G4Pow::GetInstance()->powN(X1, 3) + C3*Ma*mb*G4Pow::GetInstance()->powN(X3, 4);
return result;
}
G4double G4ParticleHPKallbachMannSyst::SeparationEnergy(G4int Ac, G4int Nc, G4int AA, G4int ZA)
G4double G4ParticleHPKallbachMannSyst::SeparationEnergy(G4int Ac, G4int Nc, G4int AA, G4int ZA,G4int Abinding,G4int Zbinding)
{
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 += -28.07*((Nc-Zc)*(Nc-Zc)/(G4double)Ac - (NA-ZA)*(NA-ZA)/(G4double)AA);
result += -18.56*(G4Pow::GetInstance()->A23(G4double(Ac)) - G4Pow::GetInstance()->A23(G4double(AA)));
result += 33.22*((Nc-Zc)*(Nc-Zc)/G4Pow::GetInstance()->powA(G4double(Ac), 4./3.) - (NA-ZA)*(NA-ZA)/G4Pow::GetInstance()->powA(G4double(AA), 4./3.));
result += -0.717*(Zc*Zc/G4Pow::GetInstance()->A13(G4double(Ac))-ZA*ZA/G4Pow::GetInstance()->A13(G4double(AA)));
result += 1.211*(Zc*Zc/Ac-ZA*ZA/AA);
result += 1.211*(Zc*Zc/(G4double)Ac-ZA*ZA/(G4double)AA);
G4double totalBinding(0);
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;
if(Zbinding==0&&Abinding==1) totalBinding=0;
if(Zbinding==1&&Abinding==1) totalBinding=0;
if(Zbinding==1&&Abinding==2) totalBinding=2.224596;
if(Zbinding==1&&Abinding==3) totalBinding=8.481798;
if(Zbinding==2&&Abinding==3) totalBinding=7.718043;
if(Zbinding==2&&Abinding==4) totalBinding=28.29566;
result += -totalBinding;
result *= MeV;
return result;
@@ -61,12 +61,12 @@ G4ParticleHPManager::G4ParticleHPManager()
,theTSInelasticFinalStates(0)
{
messenger = new G4ParticleHPMessenger( this );
if ( getenv( "G4NEUTRONHP_DO_NOT_ADJUST_FINAL_STATE" ) || getenv("G4PHP_DO_NOT_ADJUST_FINAL_STATE") ) DO_NOT_ADJUST_FINAL_STATE = true;
if ( getenv( "G4NEUTRONHP_USE_ONLY_PHOTONEVAPORATION" ) ) USE_ONLY_PHOTONEVAPORATION = true;
if ( getenv( "G4NEUTRONHP_NEGLECT_DOPPLER" ) || getenv("G4PHP_NEGLECT_DOPPLER") ) NEGLECT_DOPPLER = true;
if ( getenv( "G4NEUTRONHP_SKIP_MISSING_ISOTOPES" ) ) SKIP_MISSING_ISOTOPES = true;
if ( getenv( "G4NEUTRONHP_PRODUCE_FISSION_FRAGMENTS" ) ) PRODUCE_FISSION_FRAGMENTS = true;
if ( getenv( "G4PHP_USE_NRESP71_MODEL" ) ) USE_NRESP71_MODEL = true;
if ( std::getenv( "G4NEUTRONHP_DO_NOT_ADJUST_FINAL_STATE" ) || std::getenv("G4PHP_DO_NOT_ADJUST_FINAL_STATE") ) DO_NOT_ADJUST_FINAL_STATE = true;
if ( std::getenv( "G4NEUTRONHP_USE_ONLY_PHOTONEVAPORATION" ) ) USE_ONLY_PHOTONEVAPORATION = true;
if ( std::getenv( "G4NEUTRONHP_NEGLECT_DOPPLER" ) || std::getenv("G4PHP_NEGLECT_DOPPLER") ) NEGLECT_DOPPLER = true;
if ( std::getenv( "G4NEUTRONHP_SKIP_MISSING_ISOTOPES" ) ) SKIP_MISSING_ISOTOPES = true;
if ( std::getenv( "G4NEUTRONHP_PRODUCE_FISSION_FRAGMENTS" ) ) PRODUCE_FISSION_FRAGMENTS = true;
if ( std::getenv( "G4PHP_USE_NRESP71_MODEL" ) ) USE_NRESP71_MODEL = true;
}
G4ParticleHPManager::~G4ParticleHPManager()
@@ -84,6 +84,9 @@ G4ReactionProduct * G4ParticleHPNBodyPhaseSpace::Sample(G4double anEnergy, G4dou
// in CMS
// P = Cn*std::sqrt(E')*(Emax-E')**(3*n/2-4)
G4double maxE = GetEmax(anEnergy, result->GetMass());
if(maxE<=0){
maxE=1.*CLHEP::eV;
}
G4double energy;
G4double max(0);
if(theTotalCount<=3)
@@ -36,7 +36,9 @@
// 08-09-01 Add protection that deuteron data do not selected for hydrogen and so on by T. Koi
//
// P. Arce, June-2014 Conversion neutron_hp to particle_hp
//
// June-2019 - E. Mendoza --> Modification to allow using an incomplete data library if the G4NEUTRONHP_SKIP_MISSING_ISOTOPES environmental flag is defined. The missing XS are set to 0.
// Oct-2019 - E. Mendoza --> remove restriction of using isotopes with Z>92
#include "G4ParticleHPNames.hh"
#include "G4ParticleHPManager.hh"
#include "G4SandiaTable.hh"
@@ -67,52 +69,44 @@
//G4ParticleHPDataUsed G4ParticleHPNames::GetName(G4int A, G4int Z, G4String base, G4String rest, G4bool & aFlag)
G4ParticleHPDataUsed G4ParticleHPNames::GetName(G4int A, G4int Z, G4int M, G4String base, G4String rest, G4bool & aFlag)
{
G4int verboseLevel = G4ParticleHPManager::GetInstance()->GetVerboseLevel();
G4int verboseLevel = G4ParticleHPManager::GetInstance()->GetVerboseLevel();
//G4cout << Z << " " << A << " " << M << " " << base << " " << rest << G4endl;
//Excited isomer indicator
std::stringstream ss;
G4String sM;
if ( M > 0 )
{
ss << "m";
ss << M;
ss >> sM;
ss.clear();
}
//Excited isomer indicator
std::stringstream ss;
G4String sM;
if (M > 0) {
ss << "m";
ss << M;
ss >> sM;
ss.clear();
}
G4ParticleHPDataUsed result;
aFlag = true;
if(getenv("NeutronHPNames")) G4cout << "Names::GetName entered for Z = " << Z << ", A = " << A <<G4endl;
G4ParticleHPDataUsed result;
aFlag = true;
if (std::getenv("NeutronHPNames") ) G4cout << "Names::GetName entered for Z = " << Z << ", A = " << A <<G4endl;
G4int myA = A;
G4int myZ = Z;
G4int myA = A;
G4int myZ = Z;
if(Z>92.5&&!getenv("AllowForHeavyElements") )
{
//G4cerr << "Please contact Hans-Peter.Wellisch@cern.ch"<<G4endl;
G4cerr << "Please contact Geant4 Hadron Group Coordinator"<<G4endl;
throw G4HadronicException(__FILE__, __LINE__, "G4ParticleHPNames::GetName - data with Z>92 are not provided");
}
G4String * theName = 0;
G4String theFileName("");
G4String * theName = 0;
G4String theFileName("");
// G4int inc = 1;
G4int flip_Z = 1;
G4int delta_Z = 0;
G4int flip_Z = 1;
G4int delta_Z = 0;
G4int flip_A = 1;
G4int delta_A = 0;
G4int flip_A = 1;
G4int delta_A = 0;
//std::ifstream * check = new std::ifstream(".dummy");
std::istringstream* check = NULL;
G4bool first = true;
if(getenv("NeutronHPNames")) G4cout << "entered GetName!!!"<<G4endl;
do
std::istringstream* check = NULL;
G4bool first = true;
if (std::getenv("NeutronHPNames")) G4cout << "entered GetName!!!"<<G4endl;
do
{
aFlag = true;
G4String * biff = new G4String(); // delete here as theName
@@ -124,7 +118,7 @@ if(getenv("NeutronHPNames")) G4cout << "entered GetName!!!"<<G4endl;
result.SetA(myA);
result.SetZ(myZ);
result.SetM(M);
if(getenv("NeutronHPNames")) G4cout <<"HPWD 1 "<<*theName<<G4endl;
if(std::getenv("NeutronHPNames")) G4cout <<"HPWD 1 "<<*theName<<G4endl;
// T.K. debug for memory leak
if ( check != NULL ) {
@@ -149,7 +143,7 @@ if(getenv("NeutronHPNames")) G4cout <<"HPWD 1 "<<*theName<<G4endl;
*biff = base+"/CrossSection/"+itoa(myZ)+"_"+"nat"+"_"+theString[myZ-1];
delete theName;
theName = biff;
if(getenv("NeutronHPNames")) G4cout <<"HPWD 2 "<<*theName<<G4endl;
if(std::getenv("NeutronHPNames")) G4cout <<"HPWD 2 "<<*theName<<G4endl;
result.SetName(*theName);
G4double natA = myZ/G4SandiaTable::GetZtoA(myZ);
result.SetA(natA);
@@ -172,7 +166,7 @@ if(getenv("NeutronHPNames")) G4cout <<"HPWD 2 "<<*theName<<G4endl;
if ( rest=="/CrossSection" ) *biff = base+rest+"/"+itoa(myZ)+"_"+"nat"+"_"+theString[myZ-1];
delete theName;
theName = biff;
if(getenv("NeutronHPNames")) G4cout <<"HPWD 3 "<<*theName<<G4endl;
if(std::getenv("NeutronHPNames")) G4cout <<"HPWD 3 "<<*theName<<G4endl;
result.SetName(*theName);
natA = myZ/G4SandiaTable::GetZtoA(myZ);
result.SetA(natA);
@@ -190,7 +184,7 @@ if(getenv("NeutronHPNames")) G4cout <<"HPWD 3 "<<*theName<<G4endl;
*biff = base+"/"+rest+itoa(myZ)+"_"+itoa(myA)+"_"+theString[myZ-1];
if(theName!=0) delete theName;
theName = biff;
if(getenv("NeutronHPNames")) G4cout <<"HPWD 4 "<<*theName<<G4endl;
if(std::getenv("NeutronHPNames")) G4cout <<"HPWD 4 "<<*theName<<G4endl;
result.SetName(*theName);
result.SetA(myA);
result.SetZ(myZ);
@@ -206,91 +200,67 @@ if(getenv("NeutronHPNames")) G4cout <<"HPWD 4 "<<*theName<<G4endl;
//fileName = base+"/"+rest+"/"+itoa(myZ)+"_"+itoa(myA)+sM+"_"+theString[myZ-1];
fileName = base+rest+"/"+itoa(myZ)+"_"+itoa(myA)+sM+"_"+theString[myZ-1];
if(getenv("NeutronHPNames")) G4cout <<"HPWD 4a "<<*theName<<G4endl;
if(std::getenv("NeutronHPNames")) G4cout <<"HPWD 4a "<<*theName<<G4endl;
}
else
{
} else {
// For FS
fileName = base+"/"+rest+"/"+itoa(myZ)+"_"+itoa(myA)+sM+"_"+theString[myZ-1];
fileName = base+"/"+rest+"/"+itoa(myZ)+"_"+itoa(myA)+sM+"_"+theString[myZ-1];
file = new std::istringstream(std::ios::in);
G4ParticleHPManager::GetInstance()->GetDataStream2(fileName,*file);
if (*file) {
// isotope FS
if(std::getenv("NeutronHPNames")) G4cout <<"HPWD 4b1 "<<*theName<<G4endl;
} else {
// _nat_ FS
fileName = base+"/"+rest+"/"+itoa(myZ)+"_"+"nat"+"_"+theString[myZ-1];
delete file;
//file = new std::ifstream(fileName);
file = new std::istringstream(std::ios::in);
G4ParticleHPManager::GetInstance()->GetDataStream2(fileName,*file);
if ( *file )
{
// isotope FS
if(getenv("NeutronHPNames")) G4cout <<"HPWD 4b1 "<<*theName<<G4endl;
}
else
{
// _nat_ FS
fileName = base+"/"+rest+"/"+itoa(myZ)+"_"+"nat"+"_"+theString[myZ-1];
delete file;
//file = new std::ifstream(fileName);
file = new std::istringstream(std::ios::in);
G4ParticleHPManager::GetInstance()->GetDataStream2(fileName,*file);
if ( *file )
{
if (*file) {
// FS neither isotope nor _nat_
if(getenv("NeutronHPNames")) G4cout <<"HPWD 4b2a "<<*theName<<G4endl;
if(std::getenv("NeutronHPNames")) G4cout <<"HPWD 4b2a "<<*theName<<G4endl;
G4double natA = myZ/G4SandiaTable::GetZtoA(myZ);
tmpA = natA;
}
else
{
if(getenv("NeutronHPNames")) G4cout <<"HPWD 4b2c "<<*theName<<G4endl;
} else {
if(std::getenv("NeutronHPNames")) G4cout <<"HPWD 4b2c "<<*theName<<G4endl;
fileName="INVALID";
}
}
}
delete file;
}
result.SetName(fileName);
result.SetA(tmpA);
result.SetZ(myZ);
result.SetM(M);
delete file;
}
result.SetName(fileName);
result.SetA(tmpA);
result.SetZ(myZ);
result.SetM(M);
}
do
{
// if (std::abs(myZ-Z)>theMaxOffSet||myZ==0||myA==0)
if ( delta_Z > theMaxOffSet )
{
//if ( inc > 0 )
//{
// inc*= -1;
// myZ = Z;
// myA = A;
//}
//else
//{
G4cout <<"G4ParticleHPNames: Sorry, this material does not come near to any data."<<G4endl;
G4cout <<"G4ParticleHPNames: Please make sure G4NEUTRONHPDATA points to the" << G4endl;
G4cout <<" directory, the neutron scattering data are located in." << G4endl;
G4cout << "G4ParticleHPNames: The material was: A="<<A<<", Z="<<Z<<G4endl;
//throw G4HadronicException(__FILE__, __LINE__, "In case the data sets are at present not available in the neutron data library, please contact Hans-Peter.Wellisch@cern.ch");
throw G4HadronicException(__FILE__, __LINE__, "In case the data sets are at present not available in the neutron data library, please contact Hadron Group Coordinator");
/*
160910 TK makes commented out sructurally dead code
delete theName;
theFileName = "";
return result;
*/
//}
}
if (delta_Z > theMaxOffSet) {
if (!G4ParticleHPManager::GetInstance()->GetSkipMissingIsotopes() ) {
G4cout << "G4ParticleHPNames: There are no data available for some isotopes in this material " << G4endl;
G4cout << "G4ParticleHPNames: nor are there data for nearby isotopes." << G4endl;
G4cout << "G4ParticleHPNames: Please make sure G4NEUTRONHPDATA points to the directory " << G4endl;
G4cout << "G4ParticleHPNames: in which the neutron scattering data are located." << G4endl;
G4cout << "G4ParticleHPNames: The material was A = " << A << ", Z = " << Z << G4endl;
throw G4HadronicException(__FILE__, __LINE__, "In case the data sets are at present not available in the neutron data library, please contact Hadron Group Coordinator");
} else {
check = new std::istringstream(std::ios::in);
break;
}
}
//if ( std::abs( myA - A ) > theMaxOffSet )
if ( delta_A > 2*theMaxOffSet )
{
if (delta_A > 2*theMaxOffSet) {
delta_A = 0;
flip_A = 1;
@@ -314,9 +284,7 @@ if(getenv("NeutronHPNames")) G4cout <<"HPWD 4b2c "<<*theName<<G4endl;
}
// myZ += inc;
}
else
{
} else {
if ( flip_A > 0 )
{
delta_A += 1;
@@ -330,7 +298,7 @@ if(getenv("NeutronHPNames")) G4cout <<"HPWD 4b2c "<<*theName<<G4endl;
}
// myA += inc;
}
}
}
while( myZ == 0 || myA == 0 ); // No meaning // Loop checking, 11.05.2015, T. Koi
@@ -338,7 +306,7 @@ if(getenv("NeutronHPNames")) G4cout <<"HPWD 4b2c "<<*theName<<G4endl;
}
while((!check) || (!(*check))); // Loop checking, 11.05.2015, T. Koi
if(getenv("NeutronHPNamesLogging") || getenv("NeutronHPNames"))
if(std::getenv("NeutronHPNamesLogging") || std::getenv("NeutronHPNames"))
{
G4cout << "Names::GetName: last theName proposal = "<< G4endl;
G4cout << *theName <<" "<<A<<" "<<Z<<" "<<result.GetName()<<G4endl;
@@ -350,7 +318,7 @@ if(getenv("NeutronHPNames")) G4cout <<"HPWD 4b2c "<<*theName<<G4endl;
if ( rest == "/CrossSection" )
{
G4String reac = base;
G4String dir = getenv("G4NEUTRONHPDATA");
G4String dir = std::getenv("G4NEUTRONHPDATA");
reac.erase ( 0 , dir.length() );
if ( G4ParticleHPManager::GetInstance()->GetSkipMissingIsotopes() && !( Z == result.GetZ() && result.IsThisNaturalAbundance() ) )
{
@@ -79,7 +79,7 @@ G4int G4ParticleHPProduct::GetMultiplicity(G4double anEnergy )
#else
if( theMultiplicityMethod == G4HPMultiPoisson ) {
multi = G4Poisson ( mean );
if( getenv("G4PHPTEST") ) G4cout << " MULTIPLICITY MULTIPLIED " << multi << " " << theMassCode << G4endl;
if( std::getenv("G4PHPTEST") ) G4cout << " MULTIPLICITY MULTIPLIED " << multi << " " << theMassCode << G4endl;
} else { // if( theMultiplicityMethod == G4HPMultiBetweenInts ) {
G4double radnf = CLHEP::RandFlat::shoot();
G4int imulti = G4int(mean);
@@ -92,7 +92,7 @@ G4int G4ParticleHPProduct::GetMultiplicity(G4double anEnergy )
// if( CLHEP::RandFlat::shoot() > mean-multi ) multi++;
}
#ifdef G4PHPDEBUG
if( getenv("G4ParticleHPDebug") ) G4cout << "G4ParticleHPProduct::GetMultiplicity " << theMassCode << " " << theMass << " multi " << multi << " mean " << mean << G4endl;
if( std::getenv("G4ParticleHPDebug") ) G4cout << "G4ParticleHPProduct::GetMultiplicity " << theMassCode << " " << theMass << " multi " << multi << " mean " << mean << G4endl;
#endif
}
@@ -118,13 +118,13 @@ G4ReactionProductVector * G4ParticleHPProduct::Sample(G4double anEnergy, G4int m
for(i=0;i<multi;i++)
{
#ifdef G4PHPDEBUG
if( getenv("G4PHPTEST") )
if( getenv("G4ParticleHPDebug") && tmp != 0 ) G4cout << multi << " " << i << " @@@ G4ParticleHPProduct::Sample " << anEnergy << " Mass " << theMassCode << " " << theMass << G4endl;
if( std::getenv("G4PHPTEST") )
if( std::getenv("G4ParticleHPDebug") && tmp != 0 ) G4cout << multi << " " << i << " @@@ G4ParticleHPProduct::Sample " << anEnergy << " Mass " << theMassCode << " " << theMass << G4endl;
#endif
tmp = theDist->Sample(anEnergy, theMassCode, theMass);
if(tmp != 0) { result->push_back(tmp); }
#ifndef G4PHPDEBUG //GDEB
if( getenv("G4ParticleHPDebug") && tmp != 0 ) G4cout << multi << " " << i << " @@@ G4ParticleHPProduct::Sample " << tmp->GetDefinition()->GetParticleName() << " E= " << tmp->GetKineticEnergy() << G4endl;
if( std::getenv("G4ParticleHPDebug") && tmp != 0 ) G4cout << multi << " " << i << " @@@ G4ParticleHPProduct::Sample " << tmp->GetDefinition()->GetParticleName() << " E= " << tmp->GetKineticEnergy() << G4endl;
#endif
}
if(multi == 0)
@@ -1115,9 +1115,9 @@ void G4ParticleHPThermalScattering::buildPhysicsTable()
if ( inelasticFSs == NULL ) inelasticFSs = new std::map < G4int , std::map < G4double , std::vector < E_P_E_isoAng* >* >* >;
G4String dirName;
if ( !getenv( "G4NEUTRONHPDATA" ) )
if ( !std::getenv( "G4NEUTRONHPDATA" ) )
throw G4HadronicException(__FILE__, __LINE__, "Please setenv G4NEUTRONHPDATA to point to the neutron cross-section files.");
dirName = getenv( "G4NEUTRONHPDATA" );
dirName = std::getenv( "G4NEUTRONHPDATA" );
//G4String name;
@@ -328,9 +328,9 @@ void G4ParticleHPThermalScatteringData::BuildPhysicsTable(const G4ParticleDefini
// Read Cross Section Data files
G4String dirName;
if ( !getenv( "G4NEUTRONHPDATA" ) )
if ( !std::getenv( "G4NEUTRONHPDATA" ) )
throw G4HadronicException(__FILE__, __LINE__, "Please setenv G4NEUTRONHPDATA to point to the neutron cross-section files.");
G4String baseName = getenv( "G4NEUTRONHPDATA" );
G4String baseName = std::getenv( "G4NEUTRONHPDATA" );
dirName = baseName + "/ThermalScattering";