Import Geant4 5.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 16:57:27 +02:00
parent 330b82b769
commit 37fff30d2e
5733 changed files with 263867 additions and 74574 deletions
@@ -1,4 +1,4 @@
# $Id: GNUmakefile,v 1.1 1999/01/07 16:12:19 gunter Exp $
# $Id: GNUmakefile,v 1.2 2002/11/12 02:08:15 larazb Exp $
# -----------------------------------------------------------
# GNUmakefile for hadronic library. Gabriele Cosmo, 18/9/96.
# -----------------------------------------------------------
@@ -13,6 +13,10 @@ include $(G4INSTALL)/config/architecture.gmk
G4TMPDIR = $(G4TMP)/$(G4SYSTEM)/$(name)
ifdef PRECOMPOUND_TEST
CPPFLAGS += -DPRECOMPOUND_TEST
endif
CPPFLAGS += -I$(G4BASE)/global/management/include \
-I$(G4BASE)/global/HEPRandom/include \
-I$(G4BASE)/global/HEPNumerics/include \
@@ -14,7 +14,7 @@
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * authors in the GEANT4 collaboration. *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
@@ -14,15 +14,15 @@
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * authors in the GEANT4 collaboration. *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4ExcitedString.hh,v 1.9 2001/10/06 08:17:01 hpw Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4ExcitedString.hh,v 1.10 2002/12/12 19:17:56 gunter Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
#ifndef G4ExcitedString_h
@@ -14,15 +14,15 @@
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * authors in the GEANT4 collaboration. *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4ExcitedStringVector.hh,v 1.6 2001/10/04 20:00:32 hpw Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4ExcitedStringVector.hh,v 1.7 2002/12/12 19:17:56 gunter Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
#ifndef G4ExcitedStringVector_h
#define G4ExcitedStringVector_h 1
@@ -14,15 +14,15 @@
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * authors in the GEANT4 collaboration. *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4Fancy3DNucleus.hh,v 1.10 2002/04/24 13:10:50 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4Fancy3DNucleus.hh,v 1.14 2002/12/12 19:17:57 gunter Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
#ifndef G4Fancy3DNucleus_h
#define G4Fancy3DNucleus_h 1
@@ -75,6 +75,7 @@ class G4Fancy3DNucleus : public G4V3DNucleus
G4double GetNuclearRadius();
G4double GetNuclearRadius(const G4double maxRelativeDensity);
G4double GetOuterRadius();
G4double CoulombBarrier();
void DoLorentzBoost(const G4LorentzVector & theBoost);
void DoLorentzBoost(const G4ThreeVector & theBeta);
void DoLorentzContraction(const G4LorentzVector & theBoost);
@@ -94,7 +95,6 @@ class G4Fancy3DNucleus : public G4V3DNucleus
G4VNuclearDensity * theDensity;
G4FermiMomentum theFermi;
const G4double nucleondistance;
};
inline G4int G4Fancy3DNucleus::GetCharge()
@@ -106,7 +106,6 @@ inline G4int G4Fancy3DNucleus::GetMassNumber()
{
return myA;
}
#endif
@@ -14,15 +14,15 @@
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * authors in the GEANT4 collaboration. *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4FermiMomentum.hh,v 1.5 2001/08/01 17:09:17 hpw Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4FermiMomentum.hh,v 1.6 2002/12/12 19:17:57 gunter Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
#ifndef G4FermiMomentum_h
#define G4FermiMomentum_h 1
@@ -14,15 +14,15 @@
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * authors in the GEANT4 collaboration. *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4Fragment.hh,v 1.13 2002/06/07 15:30:55 jwellisc Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4Fragment.hh,v 1.15 2002/12/12 19:17:57 gunter Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
// Hadronic Process: Nuclear De-excitations
// by V. Lara (May 1998)
@@ -51,9 +51,6 @@ class G4ParticleDefinition;
class G4Fragment; // Forward deckaration
typedef G4std::vector<G4Fragment*> G4FragmentVector;
//#define pctest
class G4Fragment
{
public:
@@ -128,7 +125,7 @@ public:
inline G4double GetBindingEnergy(void) const;
#ifdef pctest
#ifdef PRECOMPOUND_TEST
G4String GetCreatorModel() const { return theCreatorModel; }
void SetCreatorModel(const G4String & aModel)
{ theCreatorModel = aModel; }
@@ -166,7 +163,7 @@ private:
G4double theCreationTime;
#ifdef pctest
#ifdef PRECOMPOUND_TEST
G4String theCreatorModel;
#endif
};
@@ -14,15 +14,15 @@
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * authors in the GEANT4 collaboration. *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4FragmentVector.hh,v 1.4 2001/08/01 17:09:18 hpw Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4FragmentVector.hh,v 1.5 2002/12/12 19:17:57 gunter Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
// Hadronic Process: Nuclear De-excitations
// by V. Lara (May 1998)
@@ -14,15 +14,15 @@
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * authors in the GEANT4 collaboration. *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4GeneralPhaseSpaceDecay.hh,v 1.5 2001/08/01 17:09:18 hpw Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4GeneralPhaseSpaceDecay.hh,v 1.6 2002/12/12 19:17:57 gunter Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
//$Id: G4GeneralPhaseSpaceDecay.hh,v 1.1 1997/05/21
// ----------------------------------------------------------------
@@ -14,7 +14,7 @@
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * authors in the GEANT4 collaboration. *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
@@ -81,6 +81,8 @@ class G4KineticTrack : public G4VKineticNucleon
const G4LorentzVector& Get4Momentum() const;
void Set4Momentum(const G4LorentzVector& a4Momentum);
void Update4Momentum(G4double aEnergy); // update E and p, not changing mass
void Update4Momentum(const G4ThreeVector & aMomentum); // idem
const G4LorentzVector& GetInitialCoordinates() const;
@@ -92,17 +94,17 @@ class G4KineticTrack : public G4VKineticNucleon
G4double* GetActualWidth() const;
G4double GetActualMass() const;
G4int GetnChannels() const;
private:
G4int GetnChannels() const;
void SetnChannels(const G4int aChannel);
void SetActualWidth(G4double* anActualWidth);
G4double EvaluateTotalActualWidth();
G4double EvaluateCMMomentum (const G4double mass,
const G4double* m_ij) const;
@@ -140,7 +142,7 @@ public:
G4double theFormationTime;
G4ThreeVector thePosition;
G4LorentzVector the4Momentum;
G4LorentzVector theInitialCoordinates;
@@ -154,7 +156,7 @@ public:
private:
// Temporary storage for daughter masses and widths
// (needed because Integrand Function cannot take > 1 argument)
@@ -213,6 +215,25 @@ inline void G4KineticTrack::Set4Momentum(const G4LorentzVector& a4Momentum)
the4Momentum = a4Momentum;
}
inline void G4KineticTrack::Update4Momentum(G4double aEnergy)
{
G4double newP=0;
if ( aEnergy > GetActualMass() )
{
newP = sqrt(sqr(aEnergy) - the4Momentum.mag2());
} else
{
aEnergy=GetActualMass();
}
the4Momentum = G4LorentzVector(newP*the4Momentum.vect().unit(), aEnergy);
}
inline void G4KineticTrack::Update4Momentum(const G4ThreeVector & aMomentum)
{
G4double newE=sqrt(the4Momentum.mag2() + aMomentum.mag2());
the4Momentum = G4LorentzVector(aMomentum, newE);
}
inline const G4LorentzVector& G4KineticTrack::GetInitialCoordinates() const
@@ -275,7 +296,7 @@ inline G4double G4KineticTrack::SampleResidualLifetime()
G4double theTotalActualWidth = this->EvaluateTotalActualWidth();
G4double tau = hbar_Planck * (-1.0 / theTotalActualWidth);
G4double theResidualLifetime = tau * log(G4UniformRand());
return theResidualLifetime;
return theResidualLifetime*the4Momentum.gamma();
}
@@ -14,15 +14,15 @@
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * authors in the GEANT4 collaboration. *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4KineticTrackVector.hh,v 1.6 2001/10/04 20:00:33 hpw Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4KineticTrackVector.hh,v 1.7 2002/12/12 19:17:57 gunter Exp $
// GEANT4 tag $Name: geant4-05-00 $
// Modified at 8-Oct-1998 by Maxim Komogorov. Methods BoostBeam,Boost,Shift
// were added.
@@ -14,15 +14,15 @@
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * authors in the GEANT4 collaboration. *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4NuclearFermiDensity.hh,v 1.6 2002/04/24 13:10:50 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4NuclearFermiDensity.hh,v 1.8 2002/12/12 19:17:57 gunter Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
#ifndef G4NuclearFermiDensity_h
#define G4NuclearFermiDensity_h 1
@@ -41,9 +41,21 @@ class G4NuclearFermiDensity : public G4VNuclearDensity
G4NuclearFermiDensity(G4double anA, G4double aZ);
~G4NuclearFermiDensity();
G4double GetRelativeDensity(const G4ThreeVector & aPosition) const;
G4double GetRadius(const G4double maxRelativeDenisty) const;
G4double GetDeriv(const G4ThreeVector & aPosition) const;
G4double GetRelativeDensity(const G4ThreeVector & aPosition) const
{
return 1./(1.+exp((aPosition.mag()-theR)/a));
}
G4double GetRadius(const G4double maxRelativeDenisty) const
{
return (maxRelativeDenisty>0 && maxRelativeDenisty <= 1 ) ?
(theR + a*log((1-maxRelativeDenisty+exp(-1*theR/a))/maxRelativeDenisty)) : DBL_MAX;
}
G4double GetDeriv(const G4ThreeVector & aPosition) const
{
return -exp((aPosition.mag()-theR)/a) * sqr(GetDensity(aPosition)) / (a*Getrho0());
}
private:
@@ -14,15 +14,15 @@
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * authors in the GEANT4 collaboration. *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4NuclearShellModelDensity.hh,v 1.6 2002/04/24 13:10:50 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4NuclearShellModelDensity.hh,v 1.7 2002/12/12 19:17:57 gunter Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
#ifndef G4NuclearShellModelDensity_h
#define G4NuclearShellModelDensity_h 1
@@ -14,15 +14,15 @@
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * authors in the GEANT4 collaboration. *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4Nucleon.hh,v 1.5 2001/08/01 17:09:20 hpw Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4Nucleon.hh,v 1.6 2002/12/12 19:17:57 gunter Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
#ifndef G4Nucleon_h
#define G4Nucleon_h 1
@@ -14,15 +14,15 @@
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * authors in the GEANT4 collaboration. *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4Parton.hh,v 1.13 2001/08/01 17:09:21 hpw Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4Parton.hh,v 1.14 2002/12/12 19:17:57 gunter Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
#ifndef G4Parton_h
@@ -14,15 +14,15 @@
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * authors in the GEANT4 collaboration. *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4PartonVector.hh,v 1.6 2001/10/04 20:00:33 hpw Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4PartonVector.hh,v 1.7 2002/12/12 19:17:57 gunter Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
#ifndef G4PartonVector_h
#define G4PartonVector_h 1
@@ -14,15 +14,15 @@
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * authors in the GEANT4 collaboration. *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4SampleResonance.hh,v 1.4 2001/10/04 20:00:33 hpw Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4SampleResonance.hh,v 1.5 2002/12/12 19:17:57 gunter Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
#ifndef G4SampleResonance_h
@@ -14,15 +14,15 @@
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * authors in the GEANT4 collaboration. *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4ExcitedString.cc,v 1.6 2001/10/04 20:00:33 hpw Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4ExcitedString.cc,v 1.7 2002/12/12 19:17:57 gunter Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
// ------------------------------------------------------------
@@ -14,15 +14,15 @@
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * authors in the GEANT4 collaboration. *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4Fancy3DNucleus.cc,v 1.19 2002/06/10 13:27:54 jwellisc Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4Fancy3DNucleus.cc,v 1.25 2002/12/12 19:17:57 gunter Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
// ------------------------------------------------------------
// GEANT 4 class implementation file
@@ -274,29 +274,44 @@ void G4Fancy3DNucleus::ChoosePositions()
G4int i=0;
G4ThreeVector aPos,center;
G4bool freeplace;
G4double maxR=GetNuclearRadius(0.01); // there are no nucleons at a
G4double maxR=GetNuclearRadius(0.01); // there are no nucleons at a
// relative Density of 0.01
while ( i < myA )
{
do
do
{ aPos=G4ThreeVector( (2*G4UniformRand()-1.),
(2*G4UniformRand()-1.),
(2*G4UniformRand()-1.));
} while (aPos.mag2() > 1. );
aPos *=maxR;
if (theDensity->GetRelativeDensity(aPos) > G4UniformRand() )
G4double density=theDensity->GetRelativeDensity(aPos);
if (G4UniformRand() < density)
{
freeplace= true;
for( int j=0; j<i && freeplace; j++)
G4double pFermi=theFermi.GetFermiMomentum(theDensity->GetDensity(aPos));
// protons must at least have binding energy of CoulombBarrier, so
// assuming the Fermi energy corresponds to a potential, we must place these such
// that the Fermi Energy > CoulombBarrier
if (theNucleons[i].GetDefinition() == G4Proton::Proton())
{
freeplace= freeplace &&
G4double eFermi= sqrt( sqr(pFermi) + sqr(theNucleons[i].GetDefinition()->GetPDGMass()) )
- theNucleons[i].GetDefinition()->GetPDGMass();
if (eFermi <= CoulombBarrier() ) freeplace=false;
}
for( int j=0; j<i && freeplace; j++)
{
freeplace= freeplace &&
(theNucleons[j].GetPosition()-aPos).mag() > nucleondistance;
}
if ( freeplace ) theNucleons[i++].SetPosition(aPos);
if ( freeplace )
{
theNucleons[i].SetPosition(aPos);
++i;
}
}
}
}
void G4Fancy3DNucleus::ChooseFermiMomenta()
@@ -304,19 +319,39 @@ void G4Fancy3DNucleus::ChooseFermiMomenta()
G4int i;
G4double density;
G4ThreeVector * momentum=new G4ThreeVector[myA];
G4double * fermiM=new G4double[myA];
for (G4int ntry=0; ntry<1 ; ntry ++ )
{
for (i=0; i < myA; i++ ) // momenta for all, including last, in case we swa
{
for (i=0; i < myA; i++ ) // momenta for all, including last, in case we swap nucleons
{
density = theDensity->GetDensity(theNucleons[i].GetPosition());
fermiM[i] = theFermi.GetFermiMomentum(density);
momentum[i]= theFermi.GetMomentum(density);
G4ThreeVector mom=theFermi.GetMomentum(density);
if (theNucleons[i].GetDefinition() == G4Proton::Proton())
{
G4double eMax = sqrt(sqr(fermiM[i]) +sqr(theNucleons[i].GetDefinition()->GetPDGMass()) )
- CoulombBarrier();
if ( eMax > theNucleons[i].GetDefinition()->GetPDGMass() )
{
G4double pmax2= sqr(eMax) - sqr(theNucleons[i].GetDefinition()->GetPDGMass());
fermiM[i] = sqrt(pmax2);
while ( mom.mag2() > pmax2 )
{
mom=theFermi.GetMomentum(density);
}
} else
{
G4cerr << "G4Fancy3DNucleus: difficulty finding proton momentum" << G4endl;
mom=0;
}
}
momentum[i]= mom;
}
if (ReduceSum(momentum,fermiM) )
if (ReduceSum(momentum,fermiM) )
break;
// G4cout <<" G4FancyNucleus: iterating to find momenta: "<< ntry<< G4endl;
}
@@ -325,13 +360,13 @@ void G4Fancy3DNucleus::ChooseFermiMomenta()
// for (G4int index=0; index<myA;sum+=momentum[index++])
// ;
// G4cout << "final sum / mag() " << sum << " / " << sum.mag() << G4endl;
G4double energy;
for ( i=0; i< myA ; i++ )
{
energy=theNucleons[i].GetParticleType()->GetPDGMass()
- BindingEnergy()/myA;
energy = theNucleons[i].GetParticleType()->GetPDGMass()
- BindingEnergy()/myA;
G4LorentzVector tempV(momentum[i],energy);
theNucleons[i].SetMomentum(tempV);
}
@@ -340,7 +375,7 @@ void G4Fancy3DNucleus::ChooseFermiMomenta()
delete [] fermiM;
}
class G4Fancy3DNucleusHelper // Helper class
class G4Fancy3DNucleusHelper // Helper class
{
public:
G4Fancy3DNucleusHelper(const G4ThreeVector &vec,const G4double size,const G4int index)
@@ -365,14 +400,14 @@ void G4Fancy3DNucleus::ChooseFermiMomenta()
{
return anInt;
}
G4Fancy3DNucleusHelper operator =(const G4Fancy3DNucleusHelper &right)
G4Fancy3DNucleusHelper operator =(const G4Fancy3DNucleusHelper &right)
{
Vector = right.Vector;
Size = right.Size;
anInt = right.anInt;
return *this;
}
private:
G4Fancy3DNucleusHelper(): Vector(0), Size(0), anInt(0) {G4cout << "def ctor for MixMasch" << G4endl;}
G4ThreeVector Vector;
@@ -383,32 +418,31 @@ void G4Fancy3DNucleus::ChooseFermiMomenta()
G4bool G4Fancy3DNucleus::ReduceSum(G4ThreeVector * momentum, G4double *pFermiM)
{
G4ThreeVector sum;
G4double density = theDensity->GetDensity(theNucleons[myA-1].GetPosition());
G4double PFermi=theFermi.GetFermiMomentum(density);
G4double PFermi=pFermiM[myA-1];
for (G4int i=0; i < myA-1 ; i++ )
{ sum+=momentum[i]; }
// check if have to do anything at all..
if ( sum.mag() <= PFermi )
if ( sum.mag() <= PFermi )
{
momentum[myA-1]=-sum;
return true;
}
// find all possible changes in momentum, changing only the component parallel to sum
G4ThreeVector testDir=sum.unit();
G4std::vector<G4Fancy3DNucleusHelper> testSums; // Sorted on delta.mag()
for ( G4int aNucleon=0; aNucleon < myA-1; aNucleon++){
G4ThreeVector delta=2*((momentum[aNucleon]*testDir)* testDir);
testSums.push_back(G4Fancy3DNucleusHelper(delta,delta.mag(),aNucleon));
testSums.push_back(G4Fancy3DNucleusHelper(delta,delta.mag(),aNucleon));
}
G4std::sort(testSums.begin(), testSums.end());
// reduce Momentum Sum until the next would be allowed.
G4int index=testSums.size();
while ( (sum-testSums[--index].vector()).mag()>PFermi && index>0)
while ( (sum-testSums[--index].vector()).mag()>PFermi && index>0)
{
// Only take one which improve, ie. don't change sign and overshoot...
if ( sum.mag() > (sum-testSums[index].vector()).mag() ) {
@@ -417,7 +451,7 @@ G4bool G4Fancy3DNucleus::ReduceSum(G4ThreeVector * momentum, G4double *pFermiM)
}
}
if ( (sum-testSums[index].vector()).mag() <= PFermi )
if ( (sum-testSums[index].vector()).mag() <= PFermi )
{
G4int best=-1;
G4double pBest=2*PFermi; // anything larger than PFermi
@@ -425,33 +459,32 @@ G4bool G4Fancy3DNucleus::ReduceSum(G4ThreeVector * momentum, G4double *pFermiM)
{
// find the momentum closest to choosen momentum for last Nucleon.
G4double pTry=(testSums[aNucleon].vector()-sum).mag();
if ( pTry < PFermi
if ( pTry < PFermi
&& abs(momentum[myA-1].mag() - pTry ) < pBest )
{
pBest=abs(momentum[myA-1].mag() - pTry );
pBest=abs(momentum[myA-1].mag() - pTry );
best=aNucleon;
}
}
if ( best < 0 ) G4Exception( " Logic error in Fancy3DNucleus");
if ( best < 0 ) G4Exception( "G4Fancy3DNucleus.cc: Logic error in ReduceSum()");
momentum[testSums[best].index()]-=testSums[best].vector();
momentum[myA-1]=testSums[best].vector()-sum;
testSums.clear();
return true;
}
}
testSums.clear();
// try to compensate momentum using another Nucleon....
G4int swapit=-1;
while (swapit<myA-1)
{
density = theDensity->GetDensity(theNucleons[++swapit].GetPosition());
if ( theFermi.GetFermiMomentum(density) > PFermi ) break;
while (swapit<myA-1)
{
if ( pFermiM[++swapit] > PFermi ) break;
}
if (swapit == myA-1 ) return false;
// Now we have a nucleon with a bigger Fermi Momentum.
// Exchange with last nucleon.. and iterate.
// G4cout << " Nucleon to swap with : " << swapit << G4endl;
@@ -470,5 +503,11 @@ G4bool G4Fancy3DNucleus::ReduceSum(G4ThreeVector * momentum, G4double *pFermiM)
pFermiM[myA-1]=pf;
// cout << "after swap" <<G4endl<< theNucleons[swapit] << G4endl << theNucleons[myA-1] << G4endl;
// cout << momentum[swapit] << G4endl << momentum[myA-1] << G4endl;
return ReduceSum(momentum,pFermiM);
return ReduceSum(momentum,pFermiM);
}
G4double G4Fancy3DNucleus::CoulombBarrier()
{
G4double coulombBarrier = (1.44/1.14) * MeV * myZ / (1.0 + pow(myA,1./3.));
return coulombBarrier;
}
@@ -14,15 +14,15 @@
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * authors in the GEANT4 collaboration. *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4FermiMomentum.cc,v 1.4 2001/08/01 17:09:26 hpw Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4FermiMomentum.cc,v 1.5 2002/12/12 19:17:57 gunter Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
#include "G4FermiMomentum.hh"
@@ -14,15 +14,15 @@
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * authors in the GEANT4 collaboration. *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4Fragment.cc,v 1.14 2002/06/10 13:27:54 jwellisc Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4Fragment.cc,v 1.16 2002/12/12 19:17:57 gunter Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
// Hadronic Process: Nuclear De-excitations
// by V. Lara (May 1998)
@@ -42,7 +42,7 @@ G4Fragment::G4Fragment() :
numberOfCharged(0),
theParticleDefinition(0),
theCreationTime(0.0)
#ifdef pctest
#ifdef PRECOMPOUND_TEST
,theCreatorModel("No name")
#endif
{
@@ -62,7 +62,7 @@ G4Fragment::G4Fragment(const G4Fragment &right)
numberOfCharged = right.numberOfCharged;
theParticleDefinition = right.theParticleDefinition;
theCreationTime = right.theCreationTime;
#ifdef pctest
#ifdef PRECOMPOUND_TEST
theCreatorModel = right.theCreatorModel;
#endif
}
@@ -82,7 +82,7 @@ G4Fragment::G4Fragment(const G4int A, const G4int Z, const G4LorentzVector aMome
numberOfCharged(0),
theParticleDefinition(0),
theCreationTime(0.0)
#ifdef pctest
#ifdef PRECOMPOUND_TEST
,theCreatorModel("No name")
#endif
{
@@ -111,7 +111,7 @@ G4Fragment::G4Fragment(const G4LorentzVector aMomentum, G4ParticleDefinition * a
numberOfCharged(0),
theParticleDefinition(aParticleDefinition),
theCreationTime(0.0)
#ifdef pctest
#ifdef PRECOMPOUND_TEST
,theCreatorModel("No name")
#endif
{
@@ -134,7 +134,7 @@ const G4Fragment & G4Fragment::operator=(const G4Fragment &right)
numberOfCharged = right.numberOfCharged;
theParticleDefinition = right.theParticleDefinition;
theCreationTime = right.theCreationTime;
#ifdef pctest
#ifdef PRECOMPOUND_TEST
theCreatorModel = right.theCreatorModel;
#endif
}
@@ -14,15 +14,15 @@
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * authors in the GEANT4 collaboration. *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4GeneralPhaseSpaceDecay.cc,v 1.5 2001/10/05 16:17:55 hpw Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4GeneralPhaseSpaceDecay.cc,v 1.6 2002/12/12 19:17:57 gunter Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
// $Id: G4GeneralSpaceDecay.cc,v 1.0 1998/05/21
// ----------------------------------------------------------------
@@ -14,7 +14,7 @@
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * authors in the GEANT4 collaboration. *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
@@ -358,7 +358,8 @@ G4KineticTrack::G4KineticTrack(G4ParticleDefinition* aDefinition,
}
G4double l=0; // needs to be generalized
G4double l=0;
//if(nDaughters<3) theChannel->GetAngularMomentum();
G4double theMassRatio = thePoleMass / theActualMass;
G4double theMomRatio = theActualMom / thePoleMom;
theActualWidth[index] = thePoleWidth * theMassRatio *
@@ -14,7 +14,7 @@
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * authors in the GEANT4 collaboration. *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
@@ -14,15 +14,15 @@
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * authors in the GEANT4 collaboration. *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4NuclearFermiDensity.cc,v 1.9 2002/04/24 13:10:50 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4NuclearFermiDensity.cc,v 1.11 2002/12/12 19:17:58 gunter Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
#include "G4NuclearFermiDensity.hh"
@@ -39,19 +39,5 @@ G4NuclearFermiDensity::G4NuclearFermiDensity(G4double anA, G4double aZ)
}
G4NuclearFermiDensity::~G4NuclearFermiDensity() {}
G4double G4NuclearFermiDensity::GetRelativeDensity(const G4ThreeVector & aPosition) const
{
return 1./(1.+exp((aPosition.mag()-theR)/a));
}
G4double G4NuclearFermiDensity::GetRadius(const G4double maxRelativeDensity) const
{
return (maxRelativeDensity>0 && maxRelativeDensity <= 1 ) ?
(theR + a*log((1-maxRelativeDensity+exp(-1*theR/a))/maxRelativeDensity)) : DBL_MAX;
}
G4double G4NuclearFermiDensity::GetDeriv(const G4ThreeVector & aPosition) const
{
return -exp((aPosition.mag()-theR)/a) * sqr(GetDensity(aPosition)) / (a*Getrho0());
}
@@ -14,15 +14,15 @@
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * authors in the GEANT4 collaboration. *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4NuclearShellModelDensity.cc,v 1.7 2002/04/24 13:10:50 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4NuclearShellModelDensity.cc,v 1.8 2002/12/12 19:17:58 gunter Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
#include "G4NuclearShellModelDensity.hh"
@@ -14,15 +14,15 @@
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * authors in the GEANT4 collaboration. *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4Nucleon.cc,v 1.5 2001/08/01 17:09:31 hpw Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4Nucleon.cc,v 1.6 2002/12/12 19:17:58 gunter Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
#include "G4Nucleon.hh"
@@ -14,15 +14,15 @@
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * authors in the GEANT4 collaboration. *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4Parton.cc,v 1.12 2001/11/15 14:10:48 hpw Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4Parton.cc,v 1.13 2002/12/12 19:17:58 gunter Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
// ------------------------------------------------------------
// GEANT 4 class implementation file
@@ -14,15 +14,15 @@
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * authors in the GEANT4 collaboration. *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4SampleResonance.cc,v 1.4 2001/10/06 08:17:02 hpw Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4SampleResonance.cc,v 1.5 2002/12/12 19:17:58 gunter Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
// ------------------------------------------------------------
// GEANT 4 class header file