Import Geant4 9.4.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 16:25:56 +02:00
parent 74cad5e589
commit 89a9605df1
4440 changed files with 379508 additions and 189225 deletions
@@ -23,166 +23,40 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4DecayStrongResonances.hh,v 1.9 2010/11/02 17:57:38 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
// -------------------------------------------------------------------
//
// GEANT4 Class file
//
// File name: G4DecayStrongResonances
//
// Modified:
// 02.11.2010 V.Ivanchenko moved constructor and destructor to source;
// removed unused variable
#ifndef G4DecayStrongResonances_h
#define G4DecayStrongResonances_h 1
#include "G4Fancy3DNucleus.hh"
#include "G4Nucleon.hh"
#include "G4Nucleus.hh"
#include "G4KineticTrackVector.hh"
#include "G4FragmentVector.hh"
#include "G4HadFinalState.hh"
#include "G4DynamicParticleVector.hh"
#include "G4HadTmpUtil.hh"
#include "G4ReactionProductVector.hh"
#include <algorithm>
class G4V3DNucleus;
class G4DecayStrongResonances
{
public:
G4DecayStrongResonances(){}
~G4DecayStrongResonances(){}
G4DecayStrongResonances();
~G4DecayStrongResonances();
private:
G4int operator==(G4DecayStrongResonances& right) {return (this == &right);}
G4int operator!=(G4DecayStrongResonances& right) {return (this != &right);}
G4double theEnergy;
public:
G4ReactionProductVector* Propagate(G4KineticTrackVector* theSecondaries, G4V3DNucleus* )
{
// decay the strong resonances
//static int call_count = 0;
//if(call_count++<10)
//{
// G4cout << "Security print-out: Entering G4DecayStrongResonances::Propagate";
//}
G4ReactionProductVector * theResult;
try
{
theResult = new G4ReactionProductVector;
}
catch(...)
{
throw G4HadronicException(__FILE__, __LINE__, "DecayStrongRes: out of memory ");
}
G4KineticTrackVector *result1, *secondaries, *result;
if(!theSecondaries)
{
throw G4HadronicException(__FILE__, __LINE__, "DecayStrongRes: 0x0 input vector ");
}
result1=theSecondaries;
try
{
result=new G4KineticTrackVector();
}
catch(...)
{
throw G4HadronicException(__FILE__, __LINE__, "DecayStrongRes: out of memory in ");
}
size_t aResult=0;
for (aResult=0; aResult < result1->size(); aResult++)
{
G4ParticleDefinition * pdef;
if(!result1->operator[](aResult))
{
throw G4HadronicException(__FILE__, __LINE__, "DecayStrongRes: null pointer in input vector!!! ");
}
pdef=result1->operator[](aResult)->GetDefinition();
if(!pdef)
{
throw G4HadronicException(__FILE__, __LINE__, "DecayStrongRes: 0x0 particle definition ");
}
secondaries=NULL;
if ( pdef->GetPDGWidth() > 0 && pdef->GetPDGLifeTime() < 5E-17*s )
{
try
{
secondaries = result1->operator[](aResult)->Decay();
}
catch(...)
{
throw G4HadronicException(__FILE__, __LINE__, "DecayStrongRes: failing in Decay ");
}
}
if ( secondaries == NULL )
{
try
{
result->push_back(result1->operator[](aResult));
}
catch(...)
{
throw G4HadronicException(__FILE__, __LINE__, "DecayStrongRes: push_back failed - out of memory ");
}
result1->operator[](aResult)=NULL; //protect for clearAndDestroy
}
else
{
for (size_t aSecondary=0; aSecondary<secondaries->size(); aSecondary++)
{
try
{
result1->push_back(secondaries->operator[](aSecondary));
}
catch(...)
{
throw G4HadronicException(__FILE__, __LINE__, "DecayStrongRes: push_back 1 failed - out of mem");
}
}
if(secondaries) delete secondaries;
}
}
try
{
std::for_each(result1->begin(), result1->end(), G4Delete());
delete result1;
}
catch(...)
{
throw G4HadronicException(__FILE__, __LINE__, "DecayStrongRes: memory corruption.");
}
// translate to ReactionProducts
G4ReactionProduct * it = NULL;
for(aResult=0; aResult < result->size(); aResult++)
{
try
{
it = new G4ReactionProduct();
}
catch(...)
{
throw G4HadronicException(__FILE__, __LINE__, "DecayStrongRes: out of memory ");
}
it->SetDefinition((*result)[aResult]->GetDefinition());
it->SetMass((*result)[aResult]->GetDefinition()->GetPDGMass());
it->SetTotalEnergy((*result)[aResult]->Get4Momentum().t());
it->SetMomentum((*result)[aResult]->Get4Momentum().vect());
try
{
theResult->push_back(it);
}
catch(...)
{
throw G4HadronicException(__FILE__, __LINE__, "DecayStrongRes: push to result failed - out of mem.");
}
}
try
{
std::for_each(result->begin(), result->end(), G4Delete());
delete result;
}
catch(...)
{
throw G4HadronicException(__FILE__, __LINE__, "DecayStrongRes: memory corruption at end.");
}
return theResult;
}
G4ReactionProductVector* Propagate(G4KineticTrackVector* theSecondaries,
G4V3DNucleus* );
};
#endif // G4DecayStrongResonances_h
@@ -44,6 +44,9 @@
#include "G4FermiMomentum.hh"
#include <vector>
// to test if we can drop old interface for (A,Z), comment next line..
//#define NON_INTEGER_A_Z 1
class G4Fancy3DNucleus : public G4V3DNucleus
{
@@ -66,7 +69,10 @@ class G4Fancy3DNucleus : public G4V3DNucleus
G4bool ReduceSum(G4ThreeVector * momentum, G4double *);
public:
#if defined(NON_INTEGER_A_Z)
void Init(G4double theA, G4double theZ);
#endif
void Init(G4int theA, G4int theZ);
G4bool StartLoop();
G4Nucleon * GetNextNucleon();
const std::vector<G4Nucleon *> & GetNucleons();
@@ -39,7 +39,7 @@ class G4FermiMomentum
G4FermiMomentum();
~G4FermiMomentum();
inline void Init(G4double anA, G4double aZ) {theA = anA; theZ = aZ;}
inline void Init(G4int anA, G4int aZ) {theA = anA; theZ = aZ;}
inline G4double GetFermiMomentum(G4double density)
{
@@ -66,8 +66,8 @@ class G4FermiMomentum
private:
G4double theA;
G4double theZ;
G4int theA;
G4int theZ;
// pmax= hbar * c * ( 3* pi**2 * rho )**(1/3) =
// hbar * c * ( 3* pi**2 )**(1/3) * rho**(1/3)=
// constofpmax * rho**(1/3)
@@ -23,35 +23,48 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4Fragment.hh,v 1.16 2010/09/28 16:09:00 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
//---------------------------------------------------------------------
//
// Geant4 header G4Fragment
//
// Hadronic Process: Nuclear De-excitations
// by V. Lara (May 1998)
//
// Modifications:
// 03.05.2010 V.Ivanchenko General cleanup of inline functions: objects
// are accessed by reference; remove double return
// tolerance of excitation energy at modent it is computed;
// safe computation of excitation for exotic fragments
// 18.05.2010 V.Ivanchenko added member theGroundStateMass and inline
// method which allowing to compute this value once and use
// many times
// 26.09.2010 V.Ivanchenko added number of protons, neutrons, proton holes
// and neutron holes as members of the class and Get/Set methods;
// removed not needed 'const'; removed old debug staff and unused
// private methods; add comments and reorder methods for
// better reading
#ifndef G4Fragment_h
#define G4Fragment_h 1
#include "G4ios.hh"
#include <iomanip>
#include <vector>
#include "globals.hh"
#include "G4LorentzVector.hh"
#include "G4ParticleMomentum.hh"
#include "G4ThreeVector.hh"
#include "G4NucleiProperties.hh"
#include "G4ParticleTable.hh"
#include "G4IonTable.hh"
//#include "G4ParticleTable.hh"
//#include "G4IonTable.hh"
#include "Randomize.hh"
#include "G4Proton.hh"
#include "G4Neutron.hh"
#include "G4HadronicException.hh"
#include "G4HadTmpUtil.hh"
class G4ParticleDefinition;
class G4Fragment; // Forward deckaration
class G4Fragment;
typedef std::vector<G4Fragment*> G4FragmentVector;
class G4Fragment
@@ -60,7 +73,7 @@ public:
// ============= CONSTRUCTORS ==================
// Default constructor
// Default constructor - obsolete
G4Fragment();
// Destructor
@@ -69,13 +82,12 @@ public:
// Copy constructor
G4Fragment(const G4Fragment &right);
// Several constructors
// A,Z and 4-momentum - main constructor for fragment
G4Fragment(G4int A, G4int Z, const G4LorentzVector& aMomentum);
// A,Z and 4-momentum
G4Fragment(const G4int A, const G4int Z, const G4LorentzVector aMomentum);
// 4-momentum and pointer to G4particleDefinition (for gammas)
G4Fragment(const G4LorentzVector aMomentum, G4ParticleDefinition * aParticleDefinition);
// 4-momentum and pointer to G4particleDefinition (for gammas, e-)
G4Fragment(const G4LorentzVector& aMomentum,
G4ParticleDefinition* aParticleDefinition);
// ============= OPERATORS ==================
@@ -86,168 +98,211 @@ public:
friend std::ostream& operator<<(std::ostream&, const G4Fragment*);
friend std::ostream& operator<<(std::ostream&, const G4Fragment&);
// ============= METHODS ==================
// ============= GENERAL METHODS ==================
inline G4double GetA(void) const;
void SetA(const G4double value);
inline G4int GetZ_asInt() const;
inline G4int GetA_asInt() const;
inline void SetZandA_asInt(G4int Znew, G4int Anew);
G4double GetZ(void) const;
void SetZ(const G4double value);
G4double GetExcitationEnergy(void) const;
void SetExcitationEnergy(const G4double value);
const G4LorentzVector GetMomentum(void) const;
void SetMomentum(const G4LorentzVector value);
const G4ThreeVector GetAngularMomentum(void) const;
void SetAngularMomentum(const G4ThreeVector value);
G4int GetNumberOfExcitons(void) const;
// void SetNumberOfExcitons(const G4int value);
G4int GetNumberOfHoles(void) const;
void SetNumberOfHoles(const G4int value);
G4int GetNumberOfCharged(void) const;
void SetNumberOfCharged(const G4int value);
inline G4double GetExcitationEnergy() const;
G4int GetNumberOfParticles(void) const;
void SetNumberOfParticles(const G4int value);
inline G4ParticleDefinition * GetParticleDefinition(void) const;
void SetParticleDefinition(G4ParticleDefinition * aParticleDefinition);
G4double GetCreationTime(void) const;
void SetCreationTime(const G4double time);
// Some utility methods
inline G4double GetGroundStateMass(void) const;
inline G4double GetGroundStateMass() const;
inline G4double GetBindingEnergy() const;
inline G4double GetBindingEnergy(void) const;
inline const G4LorentzVector& GetMomentum() const;
inline void SetMomentum(const G4LorentzVector& value);
inline const G4ThreeVector& GetAngularMomentum() const;
inline void SetAngularMomentum(const G4ThreeVector& value);
#ifdef PRECOMPOUND_TEST
G4String GetCreatorModel() const { return theCreatorModel; }
void SetCreatorModel(const G4String & aModel)
{ theCreatorModel = aModel; }
#endif
// computation of mass for any Z and A
inline G4double ComputeGroundStateMass(G4int Z, G4int A) const;
// obsolete methods
inline G4double GetZ() const;
inline G4double GetA() const;
inline void SetZ(G4double value);
inline void SetA(G4double value);
// ============= METHODS FOR PRE-COMPOUND MODEL ===============
inline G4int GetNumberOfExcitons() const;
inline G4int GetNumberOfParticles() const;
inline G4int GetNumberOfCharged() const;
inline void SetNumberOfExcitedParticle(G4int valueTot, G4int valueP);
inline G4int GetNumberOfHoles() const;
inline G4int GetNumberOfChargedHoles() const;
inline void SetNumberOfHoles(G4int valueTot, G4int valueP=0);
// these methods will be removed in future
inline void SetNumberOfParticles(G4int value);
inline void SetNumberOfCharged(G4int value);
// ============= METHODS FOR PHOTON EVAPORATION ===============
inline G4int GetNumberOfElectrons() const;
inline void SetNumberOfElectrons(G4int value);
inline G4ParticleDefinition * GetParticleDefinition() const;
inline void SetParticleDefinition(G4ParticleDefinition * p);
inline G4double GetCreationTime() const;
inline void SetCreationTime(G4double time);
// ============= PRIVATE METHODS ==============================
private:
G4double CalculateExcitationEnergy(const G4LorentzVector value) const;
void ExcitationEnergyWarning();
G4ThreeVector IsotropicRandom3Vector(const G4double Magnitude = 1.0) const;
void NumberOfExitationWarning(const G4String&);
inline void CalculateExcitationEnergy();
inline void CalculateGroundStateMass();
// ============= DATA MEMBERS ==================
G4double theA;
static G4int errCount;
G4int theA;
G4double theZ;
G4int theZ;
G4double theExcitationEnergy;
G4double theGroundStateMass;
G4LorentzVector theMomentum;
G4ThreeVector theAngularMomentum;
// Exciton model data members
G4int numberOfParticles;
G4int numberOfHoles;
G4int numberOfCharged;
G4int numberOfHoles;
G4int numberOfChargedHoles;
// Gamma evaporation requeriments
// Gamma evaporation data members
G4int numberOfShellElectrons;
G4ParticleDefinition * theParticleDefinition;
G4double theCreationTime;
#ifdef PRECOMPOUND_TEST
G4String theCreatorModel;
#endif
};
// Class G4Fragment
// ============= INLINE METHOD IMPLEMENTATIONS ===================
inline G4double G4Fragment::GetA() const
inline void G4Fragment::CalculateExcitationEnergy()
{
theExcitationEnergy = theMomentum.mag() - theGroundStateMass;
if(theExcitationEnergy < 0.0) { ExcitationEnergyWarning(); }
}
inline void G4Fragment::CalculateGroundStateMass()
{
theGroundStateMass = G4NucleiProperties::GetNuclearMass(theA, theZ);
}
inline G4int G4Fragment::GetA_asInt() const
{
return theA;
}
inline void G4Fragment::SetA(const G4double value)
{
theA = value;
}
inline G4double G4Fragment::GetZ() const
inline G4int G4Fragment::GetZ_asInt() const
{
return theZ;
}
inline void G4Fragment::SetZ(const G4double value)
inline void G4Fragment::SetZandA_asInt(G4int Znew, G4int Anew)
{
theZ = value;
theZ = Znew;
theA = Anew;
CalculateGroundStateMass();
}
inline G4double G4Fragment::GetExcitationEnergy() const
{
// temporary fix for what seems to be
// a problem with rounding errors for on-shell lorentz-vectors in CLHEP.
// HPW Apr 1999 @@@@@@@
if(std::abs(theExcitationEnergy)<10*eV) return 0;
return theExcitationEnergy;
}
inline void G4Fragment::SetExcitationEnergy(const G4double )
inline G4double G4Fragment::GetGroundStateMass() const
{
// theExcitationEnergy = value;
G4cout << "Warning: G4Fragment::SetExcitationEnergy() is a dummy method. Please, avoid to use it." << G4endl;
return theGroundStateMass;
}
inline const G4LorentzVector G4Fragment::GetMomentum() const
inline G4double G4Fragment::GetBindingEnergy() const
{
return (theA-theZ)*CLHEP::neutron_mass_c2 + theZ*CLHEP::proton_mass_c2
- theGroundStateMass;
}
inline const G4LorentzVector& G4Fragment::GetMomentum() const
{
return theMomentum;
}
inline void G4Fragment::SetMomentum(const G4LorentzVector value)
inline void G4Fragment::SetMomentum(const G4LorentzVector& value)
{
theMomentum = value;
theExcitationEnergy = CalculateExcitationEnergy(value);
CalculateExcitationEnergy();
}
inline const G4ThreeVector G4Fragment::GetAngularMomentum() const
inline const G4ThreeVector& G4Fragment::GetAngularMomentum() const
{
return theAngularMomentum;
}
inline void G4Fragment::SetAngularMomentum(const G4ThreeVector value)
inline void G4Fragment::SetAngularMomentum(const G4ThreeVector& value)
{
theAngularMomentum = value;
}
inline G4double
G4Fragment::ComputeGroundStateMass(G4int Z, G4int A) const
{
return G4NucleiProperties::GetNuclearMass(A, Z);
}
inline G4double G4Fragment::GetZ() const
{
return G4double(theZ);
}
inline G4double G4Fragment::GetA() const
{
return G4double(theA);
}
inline void G4Fragment::SetZ(const G4double value)
{
theZ = G4lrint(value);
CalculateGroundStateMass();
}
inline void G4Fragment::SetA(const G4double value)
{
theA = G4lrint(value);
CalculateGroundStateMass();
}
inline G4int G4Fragment::GetNumberOfExcitons() const
{
return numberOfParticles + numberOfHoles;
}
inline void G4Fragment::SetNumberOfParticles(const G4int value)
inline G4int G4Fragment::GetNumberOfParticles() const
{
numberOfParticles = value;
}
inline G4int G4Fragment::GetNumberOfHoles() const
{
return numberOfHoles;
}
inline void G4Fragment::SetNumberOfHoles(const G4int value)
{
numberOfHoles = value;
return numberOfParticles;
}
inline G4int G4Fragment::GetNumberOfCharged() const
@@ -255,57 +310,79 @@ inline G4int G4Fragment::GetNumberOfCharged() const
return numberOfCharged;
}
inline void G4Fragment::SetNumberOfCharged(const G4int value)
inline
void G4Fragment::SetNumberOfExcitedParticle(G4int valueTot, G4int valueP)
{
if (value <= numberOfParticles) numberOfCharged = value;
else
{
G4String text = "G4Fragment::SetNumberOfCharged: Number of charged particles can't be greater than number of particles";
throw G4HadronicException(__FILE__, __LINE__, text);
numberOfParticles = valueTot;
numberOfCharged = valueP;
if(valueTot < valueP) {
NumberOfExitationWarning("SetNumberOfExcitedParticle");
}
}
inline G4int G4Fragment::GetNumberOfParticles() const
inline G4int G4Fragment::GetNumberOfHoles() const
{
return numberOfParticles;
return numberOfHoles;
}
inline G4int G4Fragment::GetNumberOfChargedHoles() const
{
return numberOfChargedHoles;
}
inline G4ParticleDefinition * G4Fragment::GetParticleDefinition(void) const
inline void G4Fragment::SetNumberOfHoles(G4int valueTot, G4int valueP)
{
numberOfHoles = valueTot;
numberOfChargedHoles = valueP;
if(valueTot < valueP) {
NumberOfExitationWarning("SetNumberOfHoles");
}
}
inline void G4Fragment::SetNumberOfParticles(G4int value)
{
numberOfParticles = value;
}
inline void G4Fragment::SetNumberOfCharged(G4int value)
{
numberOfCharged = value;
if(value > numberOfParticles) {
NumberOfExitationWarning("SetNumberOfCharged");
}
}
inline G4int G4Fragment::GetNumberOfElectrons() const
{
return numberOfShellElectrons;
}
inline void G4Fragment::SetNumberOfElectrons(G4int value)
{
numberOfShellElectrons = value;
}
inline
G4ParticleDefinition * G4Fragment::GetParticleDefinition(void) const
{
return theParticleDefinition;
}
inline void G4Fragment::SetParticleDefinition(G4ParticleDefinition * aParticleDefinition)
inline void G4Fragment::SetParticleDefinition(G4ParticleDefinition * p)
{
theParticleDefinition = aParticleDefinition;
theParticleDefinition = p;
}
inline G4double G4Fragment::GetCreationTime(void) const
inline G4double G4Fragment::GetCreationTime() const
{
return theCreationTime;
}
inline void G4Fragment::SetCreationTime(const G4double time)
inline void G4Fragment::SetCreationTime(G4double time)
{
theCreationTime = time;
}
inline G4double G4Fragment::GetGroundStateMass(void) const
{
if (theA == 0) return 0.0; // photon
else return G4ParticleTable::GetParticleTable()->
GetIonTable()->GetIonMass(G4lrint(theZ),G4lrint(theA));
}
inline G4double G4Fragment::GetBindingEnergy(void) const
{
return -GetGroundStateMass()+(theA-theZ)*G4Neutron::Neutron()->GetPDGMass()
+ theZ*G4Proton::Proton()->GetPDGMass();
}
#endif
@@ -39,7 +39,7 @@ class G4NuclearFermiDensity : public G4VNuclearDensity
{
public:
G4NuclearFermiDensity(G4double anA, G4double aZ);
G4NuclearFermiDensity(G4int anA, G4int aZ);
~G4NuclearFermiDensity();
G4double GetRelativeDensity(const G4ThreeVector & aPosition) const
@@ -39,7 +39,7 @@ class G4NuclearShellModelDensity : public G4VNuclearDensity
{
public:
G4NuclearShellModelDensity(G4double anA, G4double aZ);
G4NuclearShellModelDensity(G4int anA, G4int aZ);
~G4NuclearShellModelDensity();
G4double GetRelativeDensity(const G4ThreeVector & aPosition) const;