Import Geant4 0.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 15:09:25 +02:00
parent b97f8d0df7
commit aaa409b6ee
2922 changed files with 55107 additions and 81674 deletions
@@ -1,4 +1,4 @@
# $Id: GNUmakefile,v 1.1 1998/08/22 09:08:54 hpw Exp $
# $Id: GNUmakefile,v 1.1 1999/01/07 16:12:19 gunter Exp $
# -----------------------------------------------------------
# GNUmakefile for hadronic library. Gabriele Cosmo, 18/9/96.
# -----------------------------------------------------------
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4ExcitedString.hh,v 1.10 1998/12/16 14:59:35 gugu Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4ExcitedString.hh,v 1.2 1999/02/19 13:28:07 hpw Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
#ifndef G4ExcitedString_h
@@ -53,7 +53,7 @@ class G4ExcitedString
const G4ThreeVector & GetPosition() const;
void SetPosition(const G4ThreeVector &aPosition);
void SetPosition(const G4ThreeVector &aPosition);
const G4PartonVector * GetPartonList() const;
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4ExcitedStringVector.hh,v 1.1 1998/08/22 08:57:49 hpw Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4ExcitedStringVector.hh,v 1.1 1999/01/07 16:12:19 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
#ifndef G4ExcitedStringVector_h
#define G4ExcitedStringPartonVector_h 1
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4Fancy3DNucleus.hh,v 1.4 1998/10/30 16:38:40 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4Fancy3DNucleus.hh,v 1.4 1999/05/26 15:21:32 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
#ifndef G4Fancy3DNucleus_h
#define G4Fancy3DNucleus_h 1
@@ -48,6 +48,7 @@ class G4Fancy3DNucleus : public G4V3DNucleus
void ChoosePositions();
void ChooseFermiMomenta();
G4double BindingEnergy();
G4bool ReduceSum(G4ThreeVector * momentum, G4double *);
public:
void Init(G4double theA, G4double theZ);
@@ -77,6 +78,7 @@ class G4Fancy3DNucleus : public G4V3DNucleus
G4VNuclearDensity * theDensity;
G4FermiMomentum theFermi;
const G4double nucleondistance;
};
inline G4int G4Fancy3DNucleus::GetCharge()
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4FermiMomentum.hh,v 1.2 1998/10/30 16:40:09 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4FermiMomentum.hh,v 1.1 1999/01/07 16:12:19 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
#ifndef G4FermiMomentum_h
#define G4FermiMomentum_h 1
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4Fragment.hh,v 1.10 1998/12/16 11:46:47 larazb Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4Fragment.hh,v 1.5 1999/05/26 16:52:25 hpw Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// Hadronic Process: Nuclear De-excitations
// by V. Lara (May 1998)
@@ -25,6 +25,10 @@
#include "G4NucleiProperties.hh"
#include "G4ParticleTable.hh"
#include "G4IonTable.hh"
#include "Randomize.hh"
#include "G4Proton.hh"
#include "G4Neutron.hh"
class G4ParticleDefinition;
@@ -34,19 +38,33 @@ typedef RWTPtrOrderedVector<G4Fragment> G4FragmentVector;
class G4Fragment
{
public:
// Default constructor
G4Fragment();
// Destructor
~G4Fragment();
// Copy constructor
G4Fragment(const G4Fragment &right);
// Several constructors
// 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);
G4Fragment(const G4int A, const G4int Z, const G4double anExEnergy, const G4LorentzVector aMomentum,
const G4ThreeVector anAngularMomentum, const G4int aNumberOfExcitons, const G4int aNumberOfHoles,
const G4int aNumberOfCharged);
G4Fragment(const G4int A, const G4int Z, const G4double anExEnergy,
const G4LorentzVector aMomentum,
const G4ThreeVector anAngularMomentum, const G4int aNumberOfExcitons,
const G4int aNumberOfHoles, const G4int aNumberOfCharged,
G4ParticleDefinition * aParticleDefinition);
// G4Fragment(const G4int A, const G4int Z, const G4double anExEnergy, const G4LorentzVector aMomentum,
// const G4ThreeVector anAngularMomentum, const G4int aNumberOfExcitons, const G4int aNumberOfHoles,
// const G4int aNumberOfCharged);
// G4Fragment(const G4int A, const G4int Z, const G4double anExEnergy,
// const G4LorentzVector aMomentum,
// const G4ThreeVector anAngularMomentum, const G4int aNumberOfExcitons,
// const G4int aNumberOfHoles, const G4int aNumberOfCharged,
// G4ParticleDefinition * aParticleDefinition);
const G4Fragment & operator=(const G4Fragment &right);
G4bool operator==(const G4Fragment &right) const;
@@ -86,10 +104,23 @@ public:
inline G4ParticleDefinition * GetParticleDefinition(void) const;
void SetParticleDefinition(G4ParticleDefinition * aParticleDefinition);
void DumpInfo() const;
G4double GetCreationTime(void) const;
void SetCreationTime(const G4double time);
// Some utility methods
inline G4double GetGroundStateMass(void) const;
inline G4double GetBindingEnergy(void) const;
private:
G4double CalculateExcitationEnergy(const G4LorentzVector value) const;
G4ThreeVector IsotropicRandom3Vector(const G4double Magnitude = 1.0) const;
G4double theA;
G4double theZ;
@@ -106,8 +137,12 @@ private:
G4int numberOfCharged;
// Gamma evaporation requeriments
G4ParticleDefinition * theParticleDefinition;
G4double theCreationTime;
};
// Class G4Fragment
@@ -134,12 +169,18 @@ inline void G4Fragment::SetZ(const G4double value)
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(abs(theExcitationEnergy)<10*eV) return 0;
return theExcitationEnergy;
}
inline void G4Fragment::SetExcitationEnergy(const G4double value)
{
theExcitationEnergy = value;
// theExcitationEnergy = value;
G4cout << "Warning: G4Fragment::SetExcitationEnergy() is a dummy method. Please, avoid to use it." << endl;
}
inline const G4LorentzVector G4Fragment::GetMomentum() const
@@ -150,6 +191,7 @@ inline const G4LorentzVector G4Fragment::GetMomentum() const
inline void G4Fragment::SetMomentum(const G4LorentzVector value)
{
theMomentum = value;
theExcitationEnergy = CalculateExcitationEnergy(value);
}
inline const G4ThreeVector G4Fragment::GetAngularMomentum() const
@@ -209,11 +251,30 @@ inline void G4Fragment::SetParticleDefinition(G4ParticleDefinition * aParticleDe
}
inline void G4Fragment::DumpInfo() const
inline G4double G4Fragment::GetCreationTime(void) const
{
G4cout << this;
return theCreationTime;
}
inline void G4Fragment::SetCreationTime(const G4double time)
{
theCreationTime = time;
}
inline G4double G4Fragment::GetGroundStateMass(void) const
{
if (theA == 0) return 0.0; // photon
else return G4ParticleTable::GetParticleTable()->
GetIonTable()->GetIonMass(theZ,theA);
}
inline G4double G4Fragment::GetBindingEnergy(void) const
{
return -GetGroundStateMass()+(theA-theZ)*G4Neutron::Neutron()->GetPDGMass()
+ theZ*G4Proton::Proton()->GetPDGMass();
}
#endif
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4FragmentVector.hh,v 1.1 1998/08/22 08:57:51 hpw Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4FragmentVector.hh,v 1.1 1999/01/07 16:12:20 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// Hadronic Process: Nuclear De-excitations
// by V. Lara (May 1998)
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4GeneralPhaseSpaceDecay.hh,v 1.2 1998/11/18 18:23:23 kurasige Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4GeneralPhaseSpaceDecay.hh,v 1.1 1999/01/07 16:12:20 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//$Id: G4GeneralPhaseSpaceDecay.hh,v 1.1 1997/05/21
// ----------------------------------------------------------------
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4KineticTrack.hh,v 1.1 1998/08/22 08:57:54 hpw Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4KineticTrack.hh,v 1.1 1999/01/07 16:12:20 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// $Id: G4KineticTrack.hh,v 1.0 1998/05/20
// -----------------------------------------------------------------------------
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4KineticTrackVector.hh,v 1.2 1998/10/09 13:46:50 maxim Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4KineticTrackVector.hh,v 1.1 1999/01/07 16:12:21 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
// Modified at 8-Oct-1998 by Maxim Komogorov. Methods BoostBeam,Boost,Shift
// were added.
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4NuclearFermiDensity.hh,v 1.1 1998/08/22 08:57:55 hpw Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4NuclearFermiDensity.hh,v 1.1 1999/01/07 16:12:21 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
#ifndef G4NuclearFermiDensity_h
#define G4NuclearFermiDensity_h 1
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4NuclearShellModelDensity.hh,v 1.1 1998/08/22 08:57:55 hpw Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4NuclearShellModelDensity.hh,v 1.1 1999/01/07 16:12:21 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
#ifndef G4NuclearShellModelDensity_h
#define G4NuclearShellModelDensity_h 1
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4Nucleon.hh,v 1.1 1998/08/22 08:57:56 hpw Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4Nucleon.hh,v 1.2 1999/04/15 08:53:32 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
#ifndef G4Nucleon_h
#define G4Nucleon_h 1
@@ -67,7 +67,7 @@ class G4Nucleon : public G4VKineticNucleon
inline void Hit(G4VSplitableHadron * aHit) { theSplitableHadron=aHit;}
inline G4VSplitableHadron * GetSplitableHadron() const { return theSplitableHadron;}
inline G4bool AreYouHit()
inline G4bool AreYouHit() const
{
G4bool result = true;
if (theSplitableHadron==NULL) result = false;
@@ -85,6 +85,7 @@ class G4Nucleon : public G4VKineticNucleon
};
ostream & operator << (ostream &, const G4Nucleon&);
inline int G4Nucleon::operator==(const G4Nucleon &right) const
{
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4Parton.hh,v 1.1 1998/08/22 08:57:56 hpw Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4Parton.hh,v 1.6 1999/04/15 08:59:44 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
#ifndef G4Parton_h
@@ -25,10 +25,13 @@
#include "globals.hh"
#include "G4ThreeVector.hh"
#include "G4LorentzVector.hh"
#include <iostream.h>
#include "G4ParticleTable.hh"
class G4Parton
{
public:
G4Parton(){PDGencoding=0;}
G4Parton(G4int PDGencoding);
G4Parton(const G4Parton &right);
@@ -41,19 +44,30 @@ class G4Parton
int operator!=(const G4Parton &right) const;
G4int GetPDGcode() const;
G4ParticleDefinition * GetDefinition();
void DefineMomentumInZ(G4double aLightConeMomentum, G4bool aDirection);
const G4ThreeVector & GetPosition()const;
void SetPosition(const G4ThreeVector &aPosition);
const G4LorentzVector & Get4Momentum() const;
const G4LorentzVector & Get4Momentum() const;
void Set4Momentum(const G4LorentzVector & aMomentum);
void SetX(G4double anX) { theX = anX; }
private:
G4double GetMass();
private:
G4int PDGencoding;
G4ParticleDefinition * theDefinition;
G4LorentzVector theMomentum;
G4ThreeVector thePosition;
G4double theX;
};
inline int G4Parton::operator==(const G4Parton &right) const
@@ -92,15 +106,18 @@ inline void G4Parton::Set4Momentum(const G4LorentzVector & aMomentum)
theMomentum=aMomentum;
}
inline const G4Parton & G4Parton::operator=(const G4Parton &right)
inline
G4double G4Parton::GetMass()
{
PDGencoding=right.GetPDGcode();
theMomentum=right.Get4Momentum();
thePosition=right.GetPosition();
return *this;
return theDefinition->GetPDGMass();
}
inline
G4ParticleDefinition * G4Parton::GetDefinition()
{
return theDefinition;
}
#endif
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4PartonVector.hh,v 1.1 1998/08/22 08:57:57 hpw Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4PartonVector.hh,v 1.1 1999/01/07 16:12:22 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
#ifndef G4PartonVector_h
#define G4PartonVector_h 1
@@ -1,65 +0,0 @@
// This code implementation is the intellectual property of
// the RD44 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: G4VKineticNucleon.hh,v 1.1 1998/08/22 08:57:57 hpw Exp $
// GEANT4 tag $Name: geant4-00 $
//
#ifndef G4VKineticNucleon_h
#define G4VKineticNucleon_h 1
#include "G4ThreeVector.hh"
#include "G4LorentzVector.hh"
#include "G4ParticleDefinition.hh"
class G4KineticTrackVector;
class G4VKineticNucleon
{
public:
G4VKineticNucleon();
G4VKineticNucleon(const G4VKineticNucleon &right);
virtual ~G4VKineticNucleon();
const G4VKineticNucleon& operator=(const G4VKineticNucleon& right);
int operator==(const G4VKineticNucleon& right) const;
int operator!=(const G4VKineticNucleon& right) const;
virtual G4KineticTrackVector* Decay();
virtual const G4LorentzVector& Get4Momentum() const =0;
virtual G4ParticleDefinition* GetDefinition()const =0;
virtual const G4ThreeVector& GetPosition() const =0;
protected:
private:
};
// Class G4VKineticNucleon
inline G4KineticTrackVector* G4VKineticNucleon::Decay()
{
return NULL;
}
inline const G4VKineticNucleon& G4VKineticNucleon::operator=(const G4VKineticNucleon& right)
{
return *this;
}
#endif
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4ExcitedString.cc,v 1.8 1998/12/09 07:50:26 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4ExcitedString.cc,v 1.1 1999/01/07 16:12:22 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// ------------------------------------------------------------
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4Fancy3DNucleus.cc,v 1.5 1998/11/19 17:10:15 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4Fancy3DNucleus.cc,v 1.4 1999/05/20 13:24:38 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// ------------------------------------------------------------
// GEANT 4 class implementation file
@@ -24,6 +24,7 @@
#include "G4NucleiPropertiesTable.hh"
#include "Randomize.hh"
#include "G4ios.hh"
#include "rw/tvvector.h"
G4Fancy3DNucleus::G4Fancy3DNucleus()
: nucleondistance(0.8*fermi)
@@ -91,10 +92,18 @@ void G4Fancy3DNucleus::Init(G4double theA, G4double theZ)
ChoosePositions();
// CenterNucleons();
// CenterNucleons(); // This would introduce a bias
ChooseFermiMomenta();
G4double Ebinding= BindingEnergy()/myA;
for (G4int aNucleon=0; aNucleon < myA; aNucleon++)
{
theNucleons[aNucleon].SetBindingEnergy(Ebinding);
}
return;
}
@@ -270,77 +279,165 @@ void G4Fancy3DNucleus::ChoosePositions()
void G4Fancy3DNucleus::ChooseFermiMomenta()
{
G4int i;
G4ThreeVector * momentum=new G4ThreeVector[myA];
G4ThreeVector sum,sum2;
for (G4int hardtry=0; hardtry<50; hardtry++)
{
for (G4int ntry=0; ntry<50 ; ntry ++ )
{
if ( ntry > 49 ) G4cout << "G4Nucleus: Difficulties finding nucleon momenta, number of try " << ntry<< endl;
G4int i;
G4ThreeVector * momentum=new G4ThreeVector[myA];
G4double * fermiM=new G4double[myA];
for (i=0; i < myA-1; i++ ) // momenta for all but the last nucleon
for (G4int ntry=0; ntry<1 ; ntry ++ )
{
for (i=0; i < myA; i++ ) // momenta for all, including last, in case we swa
{
fermiM[i]=theFermi.GetFermiMomentum(theDensity->GetDensity(theNucleons[i].GetPosition()));
momentum[i]= theFermi.GetMomentum(theDensity->GetDensity(theNucleons[i].GetPosition()));
sum+=momentum[i];
}
G4int best;
G4double testsum;
do
{
sum=0;
for (i=0; i < myA-1 ; i++ )
{ sum+=momentum[i]; }
// G4cout << "Momenum Sum " << sum.mag() << endl;
G4ThreeVector test;
testsum=sum.mag() * (1-perCent); // forces improvement!
if ( testsum > theFermi.GetFermiMomentum(theDensity->GetDensity(theNucleons[myA-1].GetPosition())) )
{
best=-1;
for (i=0; i < myA-1 ;i++)
{
test=-1. * sum.unit() * momentum[i].mag();
if ( (sum+test-momentum[i]).mag() < testsum )
{
best=i;
testsum=(sum+test-momentum[i]).mag();
}
if ( testsum < theFermi.GetFermiMomentum(theDensity->GetDensity(theNucleons[myA-1].GetPosition())))
{ break; }
}
if (best != -1 )
{
momentum[best]=-1.*sum.unit() * momentum[best].mag();
} else
{
G4Nucleon swap= theNucleons[ntry%(myA-1)];
theNucleons[ntry%(myA-1)]=theNucleons[myA-1];
theNucleons[myA-1]=swap;
}
}
} while ( best != -1 &&
testsum > theFermi.GetFermiMomentum(theDensity->GetDensity(theNucleons[myA-1].GetPosition())));
if ( best != -1 ) // Success
{
for (sum=0, i=0; i < myA-1 ; i++ ) sum+=momentum[i];
;
momentum[myA-1]= -1 * sum;
break;
}
}
ChoosePositions();
}
if (ReduceSum(momentum,fermiM) )
break;
// G4cout <<" G4FancyNucleus: iterating to find momenta: "<< ntry<< endl;
}
G4double energy;
for ( i=0; i< myA ; i++ )
{
energy=theNucleons[i].GetParticleType()->GetPDGMass()
+ BindingEnergy()/myA;
G4LorentzVector tempV(momentum[i],energy);
theNucleons[i].SetMomentum(tempV);
}
delete [] momentum;
// G4ThreeVector sum;
// for (G4int index=0; index<myA;sum+=momentum[index++])
// ;
// cout << "final sum / mag() " << sum << " / " << sum.mag() << endl;
G4double energy;
for ( i=0; i< myA ; i++ )
{
energy=theNucleons[i].GetParticleType()->GetPDGMass()
+ BindingEnergy()/myA;
G4LorentzVector tempV(momentum[i],energy);
theNucleons[i].SetMomentum(tempV);
}
delete [] momentum;
delete [] fermiM;
}
class G4Fancy3DNucleusHelper // Helper class
{
public:
G4Fancy3DNucleusHelper(const G4ThreeVector &vec,const G4double size,const G4int index)
: Vector(vec), Size(size), anInt(index) {}
int operator ==(const G4Fancy3DNucleusHelper &right) const
{
return this==&right;
}
int operator < (const G4Fancy3DNucleusHelper &right) const
{
return this->Size<right.Size;
}
const G4ThreeVector& vector() const
{
return Vector;
}
const G4double size() const
{
return Size;
}
const G4int index() const
{
return anInt;
}
private:
G4Fancy3DNucleusHelper operator =(const G4Fancy3DNucleusHelper &right) const
{
G4cout <<" G4Fancy3DNucleus::G4Fancy3DNucleusHelper op = called------------------" << endl;
return G4Fancy3DNucleusHelper();
}
G4Fancy3DNucleusHelper(): Vector(0), Size(0), anInt(0) {G4cout << "def ctor for MixMasch" << endl;}
const G4ThreeVector Vector;
const G4double Size;
const G4int anInt;
};
G4bool G4Fancy3DNucleus::ReduceSum(G4ThreeVector * momentum, G4double *pFermiM)
{
G4ThreeVector sum;
G4double PFermi=theFermi.GetFermiMomentum(theDensity->GetDensity(theNucleons[myA-1].GetPosition()));
for (G4int i=0; i < myA-1 ; i++ )
{ sum+=momentum[i]; }
// check if have to do anything at all..
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();
RWTPtrSortedVector<G4Fancy3DNucleusHelper> testSums(myA-1); // Sorted on delta.mag()
for ( G4int aNucleon=0; aNucleon < myA-1; aNucleon++){
G4ThreeVector delta=2*((momentum[aNucleon]*testDir)* testDir);
testSums.insert(new G4Fancy3DNucleusHelper(delta,delta.mag(),aNucleon));
}
// reduce Momentum Sum until the next would be allowed.
G4int index=testSums.entries();
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() ) {
// momentum[testSums[index]->index()]-=testSums[index]->vector();
// sum-=testSums[index]->vector();
}
}
if ( (sum-testSums[index]->vector()).mag() <= PFermi )
{
G4int best=-1;
G4double pBest=2*PFermi; // anything larger than PFermi
for ( G4int aNucleon=0; aNucleon<=index; aNucleon++)
{
// find the momentum closest to choosen momentum for last Nucleon.
G4double pTry=(testSums[aNucleon]->vector()-sum).mag();
if ( pTry < PFermi
&& abs(momentum[myA-1].mag() - pTry ) < pBest )
{
pBest=abs(momentum[myA-1].mag() - pTry );
best=aNucleon;
}
}
if ( best < 0 ) G4Exception( " Logic error in Fancy3DNucleus");
// momentum[testSums[best]->index()]-=testSums[best]->vector();
// momentum[myA-1]=testSums[best]->vector()-sum;
testSums.clearAndDestroy();
return true;
}
testSums.clearAndDestroy();
// try to compensate momentum using another Nucleon....
G4int swapit=-1;
while (swapit< myA-1
&& theFermi.GetFermiMomentum(theDensity->GetDensity(theNucleons[++swapit].GetPosition())) < PFermi )
;
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 << endl;
// G4cout << " Fermi momentum test, and better.. " << PFermi << " / "
// << theFermi.GetFermiMomentum(theDensity->GetDensity(theNucleons[swapit].GetPosition())) << endl;
// cout << theNucleons[swapit]<< endl << theNucleons[myA-1] << endl;
// cout << momentum[swapit] << endl << momentum[myA-1] << endl;
G4Nucleon swap= theNucleons[swapit];
G4ThreeVector mom_swap=momentum[swapit];
G4double pf=pFermiM[swapit];
theNucleons[swapit]=theNucleons[myA-1];
momentum[swapit]=momentum[myA-1];
pFermiM[swapit]=pFermiM[myA-1];
theNucleons[myA-1]=swap;
momentum[myA-1]=mom_swap;
pFermiM[myA-1]=pf;
// cout << "after swap" <<endl<< theNucleons[swapit] << endl << theNucleons[myA-1] << endl;
// cout << momentum[swapit] << endl << momentum[myA-1] << endl;
return ReduceSum(momentum,pFermiM);
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4FermiMomentum.cc,v 1.1 1998/08/22 08:58:07 hpw Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4FermiMomentum.cc,v 1.1 1999/01/07 16:12:23 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
#include "G4FermiMomentum.hh"
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4Fragment.cc,v 1.9 1998/12/16 11:46:56 larazb Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4Fragment.cc,v 1.4 1999/04/15 11:13:06 larazb Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// Hadronic Process: Nuclear De-excitations
// by V. Lara (May 1998)
@@ -24,8 +24,10 @@ G4Fragment::G4Fragment() :
numberOfExcitons(0),
numberOfHoles(0),
numberOfCharged(0),
theParticleDefinition(0)
theParticleDefinition(0),
theCreationTime(0.0)
{
theAngularMomentum = IsotropicRandom3Vector();
}
// Copy Constructor
@@ -40,6 +42,7 @@ G4Fragment::G4Fragment(const G4Fragment &right)
numberOfHoles = right.numberOfHoles;
numberOfCharged = right.numberOfCharged;
theParticleDefinition = right.theParticleDefinition;
theCreationTime = right.theCreationTime;
}
@@ -51,70 +54,74 @@ G4Fragment::~G4Fragment()
G4Fragment::G4Fragment(const G4int A, const G4int Z, const G4LorentzVector aMomentum) :
theA(A),
theZ(Z),
theExcitationEnergy(0.0),
theMomentum(aMomentum),
theAngularMomentum(0),
numberOfExcitons(0),
numberOfHoles(0),
numberOfCharged(0),
theParticleDefinition(0)
theParticleDefinition(0),
theCreationTime(0.0)
{
theExcitationEnergy = theMomentum.mag() - G4ParticleTable::GetParticleTable()->GetIonTable()->GetIonMass( theZ, theA );
if( theExcitationEnergy < 0.0 )
if( theExcitationEnergy > -10.0 * eV )
theExcitationEnergy = 0.0;
else
{
cout << "A, Z, momentum, theExcitationEnergy"<<
A<<" "<<Z<<" "<<aMomentum<<" "<<theExcitationEnergy<<endl;
G4Exception( "G4Fragment::G4Fragment Excitation Energy < 0.0!" );
}
}
// This constructor is for initialize photons
G4Fragment::G4Fragment(const G4LorentzVector aMomentum, G4ParticleDefinition * aParticleDefinition) :
theA(0),
theZ(0),
theExcitationEnergy(0),
theMomentum(aMomentum),
theAngularMomentum(0),
numberOfExcitons(0),
numberOfHoles(0),
numberOfCharged(0),
theParticleDefinition(aParticleDefinition)
theParticleDefinition(aParticleDefinition),
theCreationTime(0.0)
{
// This constructor is for initialize photons
theExcitationEnergy = CalculateExcitationEnergy(aMomentum);
theAngularMomentum = IsotropicRandom3Vector();
}
G4Fragment::G4Fragment(const G4int A, const G4int Z, const G4double anExEnergy,
const G4LorentzVector aMomentum,
const G4ThreeVector anAngularMomentum, const G4int aNumberOfExcitons,
const G4int aNumberOfHoles, const G4int aNumberOfCharged) :
theA(A),
theZ(Z),
theExcitationEnergy(anExEnergy),
theMomentum(aMomentum),
theAngularMomentum(anAngularMomentum),
numberOfExcitons(aNumberOfExcitons),
numberOfHoles(aNumberOfHoles),
numberOfCharged(aNumberOfCharged),
theParticleDefinition(0)
{}
// G4Fragment::G4Fragment(const G4int A, const G4int Z, const G4double anExEnergy,
// const G4LorentzVector aMomentum,
// const G4ThreeVector anAngularMomentum, const G4int aNumberOfExcitons,
// const G4int aNumberOfHoles, const G4int aNumberOfCharged) :
// theA(A),
// theZ(Z),
// theExcitationEnergy(anExEnergy),
// theMomentum(aMomentum),
// theAngularMomentum(anAngularMomentum),
// numberOfExcitons(aNumberOfExcitons),
// numberOfHoles(aNumberOfHoles),
// numberOfCharged(aNumberOfCharged),
// theParticleDefinition(0)
// {}
G4Fragment::G4Fragment(const G4int A, const G4int Z, const G4double anExEnergy,
const G4LorentzVector aMomentum,
const G4ThreeVector anAngularMomentum, const G4int aNumberOfExcitons,
const G4int aNumberOfHoles, const G4int aNumberOfCharged,
G4ParticleDefinition * aParticleDefinition) :
theA(A),
theZ(Z),
theExcitationEnergy(anExEnergy),
theMomentum(aMomentum),
theAngularMomentum(anAngularMomentum),
numberOfExcitons(aNumberOfExcitons),
numberOfHoles(aNumberOfHoles),
numberOfCharged(aNumberOfCharged),
theParticleDefinition(aParticleDefinition)
{}
// G4Fragment::G4Fragment(const G4int A, const G4int Z, const G4double anExEnergy,
// const G4LorentzVector aMomentum,
// const G4ThreeVector anAngularMomentum, const G4int aNumberOfExcitons,
// const G4int aNumberOfHoles, const G4int aNumberOfCharged,
// G4ParticleDefinition * aParticleDefinition) :
// theA(A),
// theZ(Z),
// theExcitationEnergy(anExEnergy),
// theMomentum(aMomentum),
// theAngularMomentum(anAngularMomentum),
// numberOfExcitons(aNumberOfExcitons),
// numberOfHoles(aNumberOfHoles),
// numberOfCharged(aNumberOfCharged),
// theParticleDefinition(aParticleDefinition)
// {}
@@ -131,6 +138,7 @@ const G4Fragment & G4Fragment::operator=(const G4Fragment &right)
numberOfHoles = right.numberOfHoles;
numberOfCharged = right.numberOfCharged;
theParticleDefinition = right.theParticleDefinition;
theCreationTime = right.theCreationTime;
}
return *this;
}
@@ -185,3 +193,31 @@ ostream& operator << (ostream &out, const G4Fragment &theFragment)
out << &theFragment;
return out;
}
G4double G4Fragment::CalculateExcitationEnergy(const G4LorentzVector value) const
{
G4double U = value.m() - GetGroundStateMass();
if( U < 0.0 )
if( U > -10.0 * eV )
U = 0.0;
else
G4Exception( "G4Fragment::G4Fragment Excitation Energy < 0!" );
return U;
}
G4ThreeVector G4Fragment::IsotropicRandom3Vector(const G4double Magnitude) const
// Create a unit vector with a random direction isotropically distributed
{
G4double CosTheta = 1.0 - 2.0*G4UniformRand();
G4double SinTheta = sqrt(1.0 - CosTheta*CosTheta);
G4double Phi = twopi*G4UniformRand();
G4ThreeVector Vector(Magnitude*cos(Phi)*SinTheta,
Magnitude*sin(Phi)*SinTheta,
Magnitude*CosTheta);
return Vector;
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4GeneralPhaseSpaceDecay.cc,v 1.2 1998/11/18 18:23:28 kurasige Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4GeneralPhaseSpaceDecay.cc,v 1.1 1999/01/07 16:12:23 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// $Id: G4GeneralSpaceDecay.cc,v 1.0 1998/05/21
// ----------------------------------------------------------------
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4KineticTrack.cc,v 1.5 1998/12/02 17:43:37 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4KineticTrack.cc,v 1.3 1999/06/22 13:22:58 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// $Id: G4KineticTrack.cc,v 1.0 1998/05/20
// -----------------------------------------------------------------------------
@@ -146,6 +146,8 @@ G4KineticTrack::G4KineticTrack(G4ParticleDefinition* aDefinition,
theDaughterMass = NULL;
theDaughterWidth = NULL;
theActualWidth = NULL;
G4bool * theDaughterIsShortLived = 0;
if(nChannels!=0) theActualWidth = new G4double[nChannels];
G4int index;
@@ -161,12 +163,14 @@ G4KineticTrack::G4KineticTrack(G4ParticleDefinition* aDefinition,
G4ParticleDefinition* aDaughter;
theDaughterMass = new G4double[nDaughters];
theDaughterWidth = new G4double[nDaughters];
theDaughterIsShortLived = new G4bool[nDaughters];
G4int n;
for (n = 0; n < nDaughters; n++)
{
aDaughter = theChannel->GetDaughter(n);
theDaughterMass[n] = aDaughter->GetPDGMass();
theDaughterWidth[n] = aDaughter->GetPDGWidth();
theDaughterIsShortLived[n] = aDaughter->IsShortLived();
}
//
@@ -176,7 +180,7 @@ G4KineticTrack::G4KineticTrack(G4ParticleDefinition* aDefinition,
G4double theActualMom = 0.0;
G4double thePoleMom = 0.0;
if (theDaughterWidth[0] == 0.0 & theDaughterWidth[1] == 0.0)
if ( !theDaughterIsShortLived[0] && !theDaughterIsShortLived[1] )
{
// G4cout << endl << "Both the " << nDaughters <<
@@ -188,7 +192,7 @@ G4KineticTrack::G4KineticTrack(G4ParticleDefinition* aDefinition,
theDaughterMass);
}
else if (theDaughterWidth[0] == 0.0 & theDaughterWidth[1] != 0.0)
else if ( !theDaughterIsShortLived[0] && theDaughterIsShortLived[1] )
{
// G4cout << endl << "Only the first of the " << nDaughters <<
@@ -198,7 +202,7 @@ G4KineticTrack::G4KineticTrack(G4ParticleDefinition* aDefinition,
thePoleMom = IntegrateCMMomentum(thePoleMass);
}
else if (theDaughterWidth[0] != 0.0 & theDaughterWidth[1] == 0.0)
else if ( theDaughterIsShortLived[0] && !theDaughterIsShortLived[1] )
{
// G4cout << endl << "Only the second of the " << nDaughters <<
@@ -215,13 +219,13 @@ G4KineticTrack::G4KineticTrack(G4ParticleDefinition* aDefinition,
thePoleMom = IntegrateCMMomentum(thePoleMass);
}
else if (theDaughterWidth[0] != 0.0 & theDaughterWidth[1] != 0.0)
else if ( theDaughterIsShortLived[0] && theDaughterIsShortLived[1] )
{
// G4cout << endl << "Both the " << nDaughters <<
// " decay products are resonances!";
/* code has to be implemented */
/* @@@@@@ code has to be implemented */
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4NuclearFermiDensity.cc,v 1.2 1998/10/30 16:41:52 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4NuclearFermiDensity.cc,v 1.1 1999/01/07 16:12:24 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
#include "G4NuclearFermiDensity.hh"
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4NuclearShellModelDensity.cc,v 1.2 1998/10/30 16:42:43 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4NuclearShellModelDensity.cc,v 1.1 1999/01/07 16:12:24 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
#include "G4NuclearShellModelDensity.hh"
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4Nucleon.cc,v 1.1 1998/08/22 08:58:10 hpw Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4Nucleon.cc,v 1.2 1999/04/15 09:03:39 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
#include "G4Nucleon.hh"
@@ -40,3 +40,14 @@ void G4Nucleon::Boost(const G4LorentzVector & aMomentum)
theMomentum.setE(1/mass*theMomentum.dot(aMomentum));
theMomentum.setVect(factor*aMomentum.vect() + theMomentum.vect());
}
#include <iostream.h>
ostream & operator << (ostream &s, const G4Nucleon& nucleon)
{
// s<< nucleon.GetDefinition()->GetParticleName()
// << " is " << nucleon.AreYouHit() ? " " : "not"
// << " hit. Momentum/position:" << endl;
s<< " momentum : " << nucleon.Get4Momentum() << endl;
s<< " position : " << nucleon.GetPosition() ;
return s;
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4Parton.cc,v 1.1 1998/08/22 08:58:11 hpw Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4Parton.cc,v 1.3 1999/04/15 08:59:49 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// ------------------------------------------------------------
// GEANT 4 class implementation file
@@ -23,7 +23,45 @@
G4Parton::G4Parton(G4int PDGcode)
{
PDGencoding=PDGcode;
theX = 0;
theDefinition=G4ParticleTable::GetParticleTable()->FindParticle(PDGencoding);;
if (theDefinition == NULL)
{
cout << "Encoding = "<<PDGencoding<<endl;
G4Exception("G4Parton::GetDefinition(): Encoding not in particle table");
}
}
G4Parton::G4Parton(const G4Parton &right)
{
PDGencoding = right.PDGencoding;
theMomentum = right.theMomentum;
thePosition = right.thePosition;
theX = right.theX;
theDefinition = right.theDefinition;
}
const G4Parton & G4Parton::operator=(const G4Parton &right)
{
PDGencoding=right.GetPDGcode();
theMomentum=right.Get4Momentum();
thePosition=right.GetPosition();
theX = right.theX;
theDefinition = right.theDefinition;
return *this;
}
G4Parton::~G4Parton()
{}
void G4Parton::DefineMomentumInZ(G4double aLightConeMomentum, G4bool aDirection)
{
G4double Mass = GetMass();
G4LorentzVector a4Momentum = Get4Momentum();
aLightConeMomentum*=theX;
G4double TransverseMass2 = sqr(a4Momentum.px()) + sqr(a4Momentum.py()) + sqr(Mass);
a4Momentum.setPz(0.5*(aLightConeMomentum - TransverseMass2/aLightConeMomentum)*(aDirection? 1: -1));
a4Momentum.setE( 0.5*(aLightConeMomentum + TransverseMass2/aLightConeMomentum));
Set4Momentum(a4Momentum);
}
@@ -1,44 +0,0 @@
// This code implementation is the intellectual property of
// the RD44 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: G4VKineticNucleon.cc,v 1.1 1998/08/22 08:58:11 hpw Exp $
// GEANT4 tag $Name: geant4-00 $
//
#include "G4VKineticNucleon.hh"
G4VKineticNucleon::G4VKineticNucleon()
{
}
G4VKineticNucleon::G4VKineticNucleon(const G4VKineticNucleon &right)
{
}
G4VKineticNucleon::~G4VKineticNucleon()
{
}
//const G4VKineticNucleon & G4VKineticNucleon::operator=(const G4VKineticNucleon &right)
//{}
int G4VKineticNucleon::operator==(const G4VKineticNucleon &right) const
{
return this == &right;
}
int G4VKineticNucleon::operator!=(const G4VKineticNucleon &right) const
{
return this != &right;
}