Import Geant4 9.3.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 16:15:05 +02:00
parent b79225fb37
commit 74cad5e589
3877 changed files with 234205 additions and 167127 deletions
@@ -23,29 +23,54 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4HadronicInteraction.cc,v 1.6 2009/08/30 16:12:34 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-03 $
//
// Hadronic Interaction base class
// original by H.P. Wellisch
// modified by J.L. Chuma, TRIUMF, 21-Mar-1997
// Last modified: 04-Apr-1997
// reimplemented 1.11.2003 JPW.
// Hadronic Interaction base class
// original by H.P. Wellisch
// modified by J.L. Chuma, TRIUMF, 21-Mar-1997
// Last modified: 04-Apr-1997
// reimplemented 1.11.2003 JPW.
// 23-Jan-2009 V.Ivanchenko move constructor and destructor to the body
#include "G4HadronicInteraction.hh"
#include "G4HadronicInteractionRegistry.hh"
#include "G4HadronicException.hh"
G4HadronicInteraction::G4HadronicInteraction(const G4String& modelName) :
verboseLevel(0), theMinEnergy(0.0), theMaxEnergy(25.0*GeV),
isBlocked(false), recoilEnergyThreshold(0.0), theModelName(modelName)
{
G4HadronicInteractionRegistry::Instance()->RegisterMe(this);
}
G4HadronicInteraction::~G4HadronicInteraction()
{
G4HadronicInteractionRegistry::Instance()->RemoveMe(this);
}
G4double
G4HadronicInteraction::SampleInvariantT(const G4ParticleDefinition*,
G4double, G4int, G4int)
{
return 0.0;
}
G4double
G4HadronicInteraction::GetMinEnergy(
G4double G4HadronicInteraction::GetMinEnergy(
const G4Material *aMaterial, const G4Element *anElement ) const
{
size_t i;
if( IsBlocked(aMaterial) )return 0.*GeV;
if( IsBlocked(anElement) )return 0.*GeV;
for( i=0; i<theMinEnergyListElements.size(); ++i )
{
size_t i;
if( IsBlocked(aMaterial) )return 0.*GeV;
if( IsBlocked(anElement) )return 0.*GeV;
for( i=0; i<theMinEnergyListElements.size(); ++i )
{
if( anElement == theMinEnergyListElements[i].second )return theMinEnergyListElements[i].first;
if( anElement == theMinEnergyListElements[i].second )
return theMinEnergyListElements[i].first;
}
for( i=0; i<theMinEnergyList.size(); ++i )
{
if( aMaterial == theMinEnergyList[i].second )return theMinEnergyList[i].first;
if( aMaterial == theMinEnergyList[i].second )
return theMinEnergyList[i].first;
}
if(IsBlocked()) return 0.*GeV;
if( verboseLevel > 0 )
@@ -53,19 +78,17 @@
<< " material " << aMaterial->GetName()
<< " not found in min energy List" << G4endl;
return theMinEnergy;
}
}
void
G4HadronicInteraction::SetMinEnergy(
G4double anEnergy,
G4Element *anElement )
{
if( IsBlocked(anElement) )
G4cout << "*** Warning from HadronicInteraction::SetMinEnergy" << G4endl
void G4HadronicInteraction::SetMinEnergy(G4double anEnergy,
const G4Element *anElement )
{
if( IsBlocked(anElement) )
G4cout << "*** Warning from HadronicInteraction::SetMinEnergy" << G4endl
<< " The model is not active for the Element "
<< anElement->GetName() << "." << G4endl;
for( size_t i=0; i<theMinEnergyListElements.size(); ++i )
for( size_t i=0; i<theMinEnergyListElements.size(); ++i )
{
if( anElement == theMinEnergyListElements[i].second )
{
@@ -73,65 +96,62 @@
return;
}
}
theMinEnergyListElements.push_back(std::pair<G4double, G4Element *>(anEnergy, anElement));
}
theMinEnergyListElements.push_back(std::pair<G4double, const G4Element *>(anEnergy, anElement));
}
void
G4HadronicInteraction::SetMinEnergy(
G4double anEnergy,
G4Material *aMaterial )
{
if( IsBlocked(aMaterial) )
G4cout << "*** Warning from HadronicInteraction::SetMinEnergy" << G4endl
void G4HadronicInteraction::SetMinEnergy(G4double anEnergy,
const G4Material *aMaterial )
{
if( IsBlocked(aMaterial) )
G4cout << "*** Warning from HadronicInteraction::SetMinEnergy" << G4endl
<< " The model is not active for the Material "
<< aMaterial->GetName() << "." << G4endl;
for( size_t i=0; i<theMinEnergyList.size(); ++i )
for( size_t i=0; i<theMinEnergyList.size(); ++i )
{
if( aMaterial == theMinEnergyList[i].second )
{
theMinEnergyList[i].first = anEnergy;
return;
}
{
theMinEnergyList[i].first = anEnergy;
return;
}
}
theMinEnergyList.push_back(std::pair<G4double, G4Material *>(anEnergy, aMaterial));
}
theMinEnergyList.push_back(std::pair<G4double, const G4Material *>(anEnergy, aMaterial));
}
G4double
G4HadronicInteraction::GetMaxEnergy(
const G4Material *aMaterial, const G4Element *anElement ) const
{
size_t i;
if( IsBlocked(aMaterial) )return 0.0*GeV;
if( IsBlocked(anElement) )return 0.0*GeV;
for( i=0; i<theMaxEnergyListElements.size(); ++i )
G4double G4HadronicInteraction::GetMaxEnergy(const G4Material *aMaterial,
const G4Element *anElement ) const
{
size_t i;
if( IsBlocked(aMaterial) )return 0.0;
if( IsBlocked(anElement) )return 0.0;
for( i=0; i<theMaxEnergyListElements.size(); ++i )
{
if( anElement == theMaxEnergyListElements[i].second )return theMaxEnergyListElements[i].first;
if( anElement == theMaxEnergyListElements[i].second )
return theMaxEnergyListElements[i].first;
}
for( i=0; i<theMaxEnergyList.size(); ++i )
for( i=0; i<theMaxEnergyList.size(); ++i )
{
if( aMaterial == theMaxEnergyList[i].second )return theMaxEnergyList[i].first;
if( aMaterial == theMaxEnergyList[i].second )
return theMaxEnergyList[i].first;
}
if(IsBlocked()) return 0.*GeV;
if( verboseLevel > 0 )
if(IsBlocked()) return 0.*GeV;
if( verboseLevel > 0 ) {
G4cout << "*** Warning from HadronicInteraction::GetMaxEnergy" << G4endl
<< " material " << aMaterial->GetName()
<< " not found in min energy List" << G4endl;
return theMaxEnergy;
<< " material " << aMaterial->GetName()
<< " not found in min energy List" << G4endl;
}
return theMaxEnergy;
}
void
G4HadronicInteraction::SetMaxEnergy(
G4double anEnergy,
G4Element *anElement )
{
if( IsBlocked(anElement) )
G4cout << "*** Warning from HadronicInteraction::SetMaxEnergy" << G4endl
void G4HadronicInteraction::SetMaxEnergy(G4double anEnergy,
const G4Element *anElement )
{
if( IsBlocked(anElement) ) {
G4cout << "*** Warning from HadronicInteraction::SetMaxEnergy" << G4endl
<< "Warning: The model is not active for the Element "
<< anElement->GetName() << "." << G4endl;
for( size_t i=0; i<theMaxEnergyListElements.size(); ++i )
}
for( size_t i=0; i<theMaxEnergyListElements.size(); ++i )
{
if( anElement == theMaxEnergyListElements[i].second )
{
@@ -139,67 +159,74 @@
return;
}
}
theMaxEnergyListElements.push_back(std::pair<G4double, G4Element *>(anEnergy, anElement));
}
theMaxEnergyListElements.push_back(std::pair<G4double, const G4Element *>(anEnergy, anElement));
}
void
G4HadronicInteraction::SetMaxEnergy(
G4double anEnergy,
G4Material *aMaterial )
{
if( IsBlocked(aMaterial) )
G4cout << "*** Warning from HadronicInteraction::SetMaxEnergy" << G4endl
void G4HadronicInteraction::SetMaxEnergy(G4double anEnergy,
const G4Material *aMaterial )
{
if( IsBlocked(aMaterial) ) {
G4cout << "*** Warning from HadronicInteraction::SetMaxEnergy" << G4endl
<< "Warning: The model is not active for the Material "
<< aMaterial->GetName() << "." << G4endl;
for( size_t i=0; i<theMaxEnergyList.size(); ++i )
}
for( size_t i=0; i<theMaxEnergyList.size(); ++i )
{
if( aMaterial == theMaxEnergyList[i].second )
{
theMaxEnergyList[i].first = anEnergy;
return;
}
{
theMaxEnergyList[i].first = anEnergy;
return;
}
}
theMaxEnergyList.push_back(std::pair<G4double, G4Material *>(anEnergy, aMaterial));
}
theMaxEnergyList.push_back(std::pair<G4double, const G4Material *>(anEnergy, aMaterial));
}
void
G4HadronicInteraction::DeActivateFor( G4Material *aMaterial )
{
theBlockedList.push_back(aMaterial);
}
void G4HadronicInteraction::DeActivateFor( const G4Material *aMaterial )
{
theBlockedList.push_back(aMaterial);
}
void
G4HadronicInteraction::DeActivateFor( G4Element *anElement )
{
theBlockedListElements.push_back(anElement);
}
void G4HadronicInteraction::DeActivateFor( const G4Element *anElement )
{
theBlockedListElements.push_back(anElement);
}
G4bool
G4HadronicInteraction::IsBlocked( const G4Material *aMaterial ) const
{
for( size_t i=0; i<theBlockedList.size(); ++i )
G4bool G4HadronicInteraction::IsBlocked( const G4Material *aMaterial ) const
{
for( size_t i=0; i<theBlockedList.size(); ++i )
{
if( aMaterial == theBlockedList[i] )
{
return true;
}
{
return true;
}
}
return false;
}
return false;
}
G4bool
G4HadronicInteraction::IsBlocked( const G4Element *anElement ) const
{
for( size_t i=0; i<theBlockedListElements.size(); ++i )
G4bool G4HadronicInteraction::IsBlocked( const G4Element *anElement ) const
{
for( size_t i=0; i<theBlockedListElements.size(); ++i )
{
if( anElement == theBlockedListElements[i] )
{
return true;
}
{
return true;
}
}
return false;
}
return false;
}
G4HadronicInteraction::G4HadronicInteraction(const G4HadronicInteraction &right )
{
*this = right;
}
const G4HadronicInteraction&
G4HadronicInteraction::operator=(const G4HadronicInteraction &right )
{
G4String text = "unintended use of G4HadronicInteraction::operator=";
throw G4HadronicException(__FILE__, __LINE__, text);
return right;
}
/* end of file */
/* end of file */
@@ -23,54 +23,80 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4HadronicInteractionRegistry.cc,v 1.9 2009/12/02 15:57:57 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-03 $
//
// 23-Jan-2009 V.Ivanchenko make the class to be a singleton
#include "G4HadronicInteractionRegistry.hh"
#include "G4HadronicInteraction.hh"
G4HadronicInteractionRegistry & G4HadronicInteractionRegistry::theRegistry()
G4HadronicInteractionRegistry* G4HadronicInteractionRegistry::theInstance = 0;
G4HadronicInteractionRegistry* G4HadronicInteractionRegistry::Instance()
{
static G4HadronicInteractionRegistry theRegistryInstance;
return theRegistryInstance;
if(0 == theInstance) {
static G4HadronicInteractionRegistry manager;
theInstance = &manager;
}
return theInstance;
}
G4HadronicInteractionRegistry::G4HadronicInteractionRegistry()
{}
G4HadronicInteractionRegistry::~G4HadronicInteractionRegistry()
{
Clean();
}
void G4HadronicInteractionRegistry::Clean()
{
size_t nModels = allModels.size();
//G4cout << "G4HadronicInteractionRegistry::Clean() start " << nModels << G4endl;
if(0 < nModels) {
for (size_t i=0; i<nModels; ++i) {
if( allModels[i] ) {
//G4cout << "delete " << i << G4endl;
//G4cout << allModels[i]->GetModelName() << G4endl;
G4HadronicInteraction * model = allModels[i];
allModels[i] = 0;
delete model;
}
}
allModels.clear();
}
//G4cout << "G4HadronicInteractionRegistry::Clean() is done " << G4endl;
}
void G4HadronicInteractionRegistry::
RegisterMe(G4HadronicInteraction * aModel)
{
theRegistry().AddModel(aModel);
if(!aModel) { return; }
size_t nModels = allModels.size();
if(nModels > 0) {
for (size_t i=0; i<nModels; ++i) {
if( aModel == allModels[i] ) { return; }
}
}
//G4cout << "Register model <" << aModel->GetModelName()
//<< "> " << nModels+1 << G4endl;
allModels.push_back(aModel);
}
void G4HadronicInteractionRegistry::
RemoveMe(G4HadronicInteraction * aModel)
{
theRegistry().allModels.erase(std::find(theRegistry().allModels.begin(),
theRegistry().allModels.end(), aModel));
theRegistry().nModels = theRegistry().allModels.size();
}
G4HadronicInteractionRegistry::~G4HadronicInteractionRegistry()
{
/*
while(allModels.size()!=0)
{
delete allModels.front();
}
*/
}
void G4HadronicInteractionRegistry::
AddModel(G4HadronicInteraction * aModel)
{
G4bool alreadyThere = false;
for(G4int i=0; i<nModels; i++)
{
if(allModels[i]==aModel)
{
alreadyThere = true;
break;
if(!aModel) { return; }
size_t nModels = allModels.size();
if(0 == nModels) { return; }
for (size_t i=0; i<nModels; ++i) {
if( aModel == allModels[i] ) {
//G4cout << "DeRegister model <" << aModel->GetModelName()
//<< "> " << i << G4endl;
allModels[i] = 0;
if(i == nModels-1) allModels.pop_back();
return;
}
}
if(!alreadyThere)
{
nModels++;
allModels.push_back(aModel);
}
}
@@ -23,28 +23,37 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4InelasticInteraction.cc,v 1.12 2009/01/24 11:56:27 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-03 $
//
//
// Hadronic Process: Inelastic Interaction
// original by H.P. Wellisch
// modified by J.L. Chuma, TRIUMF, 22-Nov-1996
// Last modified: 27-Mar-1997
// J.P. Wellisch: 23-Apr-97: throw G4HadronicException(__FILE__, __LINE__, removed
// J.P. Wellisch: 24-Apr-97: correction for SetUpPions
// Modified by J.L. Chuma, 30-Apr-97: added originalTarget to CalculateMomenta
// since TwoBody needed to reset the target particle
// J.L. Chuma, 20-Jun-97: Modified CalculateMomenta to correct the decision process
// for whether to use GenerateXandPt or TwoCluster
// J.L. Chuma, 06-Aug-97: added original incident particle, before Fermi motion and
// evaporation effects are included, needed for calculating
// self absorption and corrections for single particle spectra
// HPW removed misunderstanding of LocalEnergyDeposit, 11.04.98.
// Hadronic Process: Inelastic Interaction
// original by H.P. Wellisch
// modified by J.L. Chuma, TRIUMF, 22-Nov-1996
// Last modified: 27-Mar-1997
// J.P. Wellisch: 23-Apr-97: throw G4HadronicException(__FILE__, __LINE__, removed
// J.P. Wellisch: 24-Apr-97: correction for SetUpPions
// Modified by J.L. Chuma, 30-Apr-97: added originalTarget to CalculateMomenta
// since TwoBody needed to reset the target particle
// J.L. Chuma, 20-Jun-97: Modified CalculateMomenta to correct the decision process
// for whether to use GenerateXandPt or TwoCluster
// J.L. Chuma, 06-Aug-97: added original incident particle, before Fermi motion and
// evaporation effects are included, needed for calculating
// self absorption and corrections for single particle spectra
// HPW removed misunderstanding of LocalEnergyDeposit, 11.04.98.
// 23-Jan-2009 V.Ivanchenko move constructor and destructor to the body
#include "G4InelasticInteraction.hh"
#include "Randomize.hh"
#include "G4HadReentrentException.hh"
G4InelasticInteraction::G4InelasticInteraction(const G4String& modelName)
: G4HadronicInteraction(modelName)
{ cache = 0.0;}
G4InelasticInteraction::~G4InelasticInteraction()
{}
G4double
G4double
G4InelasticInteraction::Pmltpc( // used in Cascade functions
G4int np, G4int nm, G4int nz, G4int n, G4double b, G4double c )
{
@@ -62,7 +71,7 @@
return std::exp(r);
}
G4bool
G4bool
G4InelasticInteraction::MarkLeadingStrangeParticle(
const G4ReactionProduct &currentParticle,
const G4ReactionProduct &targetParticle,
@@ -91,7 +100,7 @@
return lead;
}
void
void
G4InelasticInteraction::SetUpPions(
const G4int np,
const G4int nm,
@@ -125,7 +134,7 @@
}
}
void
void
G4InelasticInteraction::GetNormalizationConstant(
const G4double energy, // MeV, <0 means annihilation channels
G4double &n,
@@ -169,7 +178,7 @@
}
}
void
void
G4InelasticInteraction::CalculateMomenta(
G4FastVector<G4ReactionProduct,GHADLISTSIZE> &vec,
G4int &vecLen,
@@ -343,7 +352,7 @@
}
void G4InelasticInteraction::
void G4InelasticInteraction::
Rotate(G4FastVector<G4ReactionProduct,GHADLISTSIZE> &vec, G4int &vecLen)
{
G4double rotation = 2.*pi*G4UniformRand();
@@ -357,7 +366,7 @@
}
}
void
void
G4InelasticInteraction::SetUpChange(
G4FastVector<G4ReactionProduct,GHADLISTSIZE> &vec,
G4int &vecLen,