Import Geant4 0.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-01 15:25:35 +02:00
parent 54d6b71f95
commit b97f8d0df7
3237 changed files with 807095 additions and 0 deletions
@@ -0,0 +1,45 @@
#include "G4DiffractiveHHScatterer.hh"
#include "G4DiffractiveExcitation.hh"
#include "G4ExcitedString.hh"
#include "G4LundStringFragmentation.hh"
#include "G4KineticTrack.hh"
#include "G4DiffractiveSplitableHadron.hh"
G4DiffractiveHHScatterer::G4DiffractiveHHScatterer()
:
theExcitation(new G4DiffractiveExcitation()),
theStringFragmentation(new G4LundStringFragmentation())
{}
G4KineticTrackVector * G4DiffractiveHHScatterer::
Scatter(const G4KineticTrack & aTrack, const G4KineticTrack & bTrack)
{
G4KineticTrackVector * result = new G4KineticTrackVector();
G4DiffractiveSplitableHadron aHadron(& aTrack);
G4DiffractiveSplitableHadron bHadron(& bTrack);
if ( ! theExcitation->ExciteParticipants(& aHadron, & bHadron))
{
return NULL;
}
G4ExcitedString * string;
G4KineticTrackVector * fragments=NULL;
string = theExcitation->String(& aHadron, true); // Projectile
fragments=theStringFragmentation->FragmentString(*string);
for (G4int aFragment=0; aFragment < fragments->entries(); aFragment++)
{
result->append(fragments->at(aFragment));
}
string = theExcitation->String(& bHadron, false); // Target
fragments=theStringFragmentation->FragmentString(*string);
for (G4int bFragment=0; bFragment < fragments->entries(); bFragment++)
{
result->append(fragments->at(bFragment));
}
return result;
}
@@ -0,0 +1,184 @@
// 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: G4DiffractiveSplitableHadron.cc,v 1.4 1998/11/05 17:55:36 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
//
// ------------------------------------------------------------
// GEANT 4 class implementation file
//
// For information related to this code contact:
// CERN, CN Division, ASD group
// ---------------- G4DiffractiveSplitableHadron----------------
// by Gunter Folger, August 1998.
// class splitting an interacting particle. Used by FTF String Model.
// ------------------------------------------------------------
#include "G4DiffractiveSplitableHadron.hh"
#include "G4ParticleDefinition.hh"
#include "Randomize.hh"
G4DiffractiveSplitableHadron::G4DiffractiveSplitableHadron()
{
}
G4DiffractiveSplitableHadron::G4DiffractiveSplitableHadron(const G4ReactionProduct & aPrimary)
: G4VSplitableHadron(aPrimary)
{
PartonIndex=-2;
Parton[0]=NULL;
}
G4DiffractiveSplitableHadron::G4DiffractiveSplitableHadron(const G4Nucleon & aNucleon)
: G4VSplitableHadron(aNucleon)
{
PartonIndex=-2;
Parton[0]=NULL;
}
G4DiffractiveSplitableHadron::G4DiffractiveSplitableHadron(const G4VKineticNucleon * aNucleon)
: G4VSplitableHadron(aNucleon)
{
PartonIndex=-2;
Parton[0]=NULL;
}
G4DiffractiveSplitableHadron::~G4DiffractiveSplitableHadron()
{}
const G4DiffractiveSplitableHadron & G4DiffractiveSplitableHadron::operator=(const G4DiffractiveSplitableHadron &right)
{
G4Exception("G4DiffractiveSplitableHadron::operator= meant to not be accessable");
return *this;
}
void G4DiffractiveSplitableHadron::SplitUp()
{
// Split once only...
if (Parton[0] != NULL) return;
// flavours of quark ends
G4int PDGcode=GetDefinition()->GetPDGEncoding();
G4int stringStart, stringEnd;
ChooseStringEnds(PDGcode, &stringStart,&stringEnd);
Parton[0] = new G4Parton(stringStart);
Parton[1] = new G4Parton(stringEnd);
PartonIndex=-1;
}
G4Parton * G4DiffractiveSplitableHadron::GetNextParton()
{
++PartonIndex;
if ( PartonIndex > 1 || PartonIndex < 0 ) return NULL;
return Parton[PartonIndex];
}
G4Parton * G4DiffractiveSplitableHadron::GetNextAntiParton()
{
return NULL; // to be looked at @@
}
//
//----------------------- Implementation--------------------------
//
void G4DiffractiveSplitableHadron::ChooseStringEnds(G4int PDGcode,G4int * aEnd, G4int * bEnd) const
{
const G4double udspin1= 1./6.;
const G4double uuspin1= 1./3.;
const G4double udspin0= 1./2.;
G4int absPDGcode=abs(PDGcode);
if ( absPDGcode < 1000 ) //-------------------- Meson -------------
{
G4int heavy= absPDGcode/ 100;
G4int light= (absPDGcode %100)/10;
// G4int anti= pow(-1 , max( heavy, light));
G4int anti= 1 -2 * ( max( heavy, light ) % 2 );
if (PDGcode < 0 ) anti *=-1;
heavy *= anti;
light *= -1 * anti;
if ( G4UniformRand() < 0.5 )
{
*aEnd=heavy;
*bEnd=light;
}
else
{
*aEnd=light;
*bEnd=heavy;
}
}
else //-------------------- Barion --------------
{
G4int j1000 = PDGcode/ 1000;
G4int j100 = (PDGcode % 1000) / 100;
G4int j10 = (PDGcode % 100) / 10;
G4double random= G4UniformRand();
if ( abs(j100) >= abs(j10) )
{
if ( random < udspin1 )
{
*aEnd=j1000;
*bEnd= Diquark( j100, j10, 1);
} else if ( random < (udspin1 + uuspin1) )
{
*aEnd= j10;
*bEnd= Diquark( j1000, j100, 1);
} else
{
*aEnd=j100;
*bEnd= Diquark( j1000, j10, 0);
}
} else
{
// Lambda-like hadrons have two lightest quarks in spin 0
if ( random < udspin1 )
{
*aEnd=j1000;
*bEnd= Diquark( j100, j10, 0);
} else if ( random < (udspin1 + uuspin1) )
{
*aEnd= j10;
*bEnd= Diquark( j1000, j100, 1);
} else
{
*aEnd=j100;
*bEnd= Diquark( j1000, j10, 1);
}
}
}
}
G4int G4DiffractiveSplitableHadron::Diquark(G4int aquark,G4int bquark,G4int Spin) const
{
G4int diquarkPDG;
diquarkPDG = max( abs(aquark), abs(bquark) )*1000 +
min( abs(aquark), abs(bquark) )*100 +
2*Spin + 1;
return ( aquark > 0 && bquark > 0 ) ? diquarkPDG : -1*diquarkPDG;
}
@@ -0,0 +1,148 @@
// 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: G4FTFModel.cc,v 1.5 1998/12/09 07:41:26 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
//
// ------------------------------------------------------------
// GEANT 4 class implementation file
//
// For information related to this code contact:
// CERN, CN Division, ASD group
// ---------------- G4FTFModel ----------------
// by Gunter Folger, May 1998.
// class implementing the excitation in the FTF Parton String Model
// ------------------------------------------------------------
#include "G4FTFModel.hh"
#include "G4FTFParticipants.hh"
#include "G4InteractionContent.hh"
#include "G4LorentzRotation.hh"
#include "G4ParticleDefinition.hh"
#include "G4ios.hh"
// Class G4FTFModel
G4FTFModel::G4FTFModel(G4double sigmaPt, G4double minExtraMass,G4double x0Mass)
:
theExcitation(new G4DiffractiveExcitation(sigmaPt,minExtraMass,x0Mass))
{
G4VPartonStringModel::SetThisPointer(this);
}
G4FTFModel::~G4FTFModel()
{}
const G4FTFModel & G4FTFModel::operator=(const G4FTFModel &right)
{
G4Exception("G4FTFModel::operator= is not meant to be accessed ");
return *this;
}
int G4FTFModel::operator==(const G4FTFModel &right) const
{
return this==&right;
}
int G4FTFModel::operator!=(const G4FTFModel &right) const
{
return this!=&right;
}
void G4FTFModel::Init(const G4Nucleus & aNucleus, const G4DynamicParticle & aProjectile)
{
theParticipants.Init(aNucleus.GetN(),aNucleus.GetZ());
theProjectile = aProjectile;
}
G4ExcitedStringVector * G4FTFModel::GetStrings()
{
theParticipants.BuildInteractions(theProjectile);
if (! ExciteParticipants()) return NULL;;
G4ExcitedStringVector * theStrings = BuildStrings();
return theStrings;
}
G4ExcitedStringVector * G4FTFModel::BuildStrings()
{
// Loop over all collisions; find all primaries, and all target ( targets may
// be duplicate in the List ( to unique G4VSplitableHadrons)
G4ExcitedStringVector * strings;
strings = new G4ExcitedStringVector();
RWTPtrOrderedVector<G4VSplitableHadron> primaries;
RWTPtrOrderedVector<G4VSplitableHadron> targets;
theParticipants.StartLoop(); // restart a loop
while ( theParticipants.Next() )
{
const G4InteractionContent & interaction=theParticipants.GetInteraction();
// do not allow for duplicates ...
if ( ! primaries.contains(interaction.GetProjectile()) )
primaries.insert(interaction.GetProjectile());
if ( ! targets.contains(interaction.GetTarget()) )
targets.insert(interaction.GetTarget());
}
// G4cout << "BuildStrings prim/targ " << primaries.entries() << " , " <<
// targets.entries() << endl;
G4int ahadron;
for ( ahadron=0; ahadron < primaries.entries() ; ahadron++)
{
G4bool isProjectile=true;
strings->insert(theExcitation->String(primaries[ahadron], isProjectile));
}
for ( ahadron=0; ahadron < targets.entries() ; ahadron++)
{
G4bool isProjectile=false;
strings->insert(theExcitation->String(targets[ahadron], isProjectile));
}
primaries.clearAndDestroy();
targets.clearAndDestroy();
return strings;
}
G4bool G4FTFModel::ExciteParticipants()
{
// G4cout << "G4FTFModel::ExciteParticipants starting " << endl;
while (theParticipants.Next())
{
// G4cout << "next Collision " << endl;
const G4InteractionContent & collision=theParticipants.GetInteraction();
// G4cout << " soft colls : " << collision.GetNumberOfSoftCollisions() << endl;
G4VSplitableHadron * projectile=collision.GetProjectile();
G4VSplitableHadron * target=collision.GetTarget();
if ( ! theExcitation->ExciteParticipants(projectile, target) )
{
return false;
}
}
return true;
}
@@ -0,0 +1,145 @@
// 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: G4FTFParticipants.cc,v 1.3 1998/11/05 16:32:47 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
//
// ------------------------------------------------------------
// GEANT 4 class implementation file
//
// For information related to this code contact:
// CERN, CN Division, ASD group
// ---------------- G4FTFParticipants----------------
// by Gunter Folger, June 1998.
// class finding colliding particles in FTFPartonStringModel
// ------------------------------------------------------------
#include "G4FTFParticipants.hh"
#include "G4DiffractiveSplitableHadron.hh"
#include "G4VSplitableHadron.hh"
#include "G4PomeronCrossSection.hh"
#include "Randomize.hh"
// Class G4FTFParticipants
G4FTFParticipants::G4FTFParticipants()
{
}
G4FTFParticipants::G4FTFParticipants(const G4FTFParticipants &right)
{
}
G4FTFParticipants::~G4FTFParticipants()
{
// G4cout << "G4FTFParticipants::~G4FTFParticipants() called" << endl;
}
//const G4FTFParticipants & G4FTFParticipants::operator=(const G4FTFParticipants &right)
//{}
//int G4FTFParticipants::operator==(const G4FTFParticipants &right) const
//{}
//int G4FTFParticipants::operator!=(const G4FTFParticipants &right) const
//{}
void G4FTFParticipants::BuildInteractions(const G4ReactionProduct &thePrimary)
{
StartLoop(); // reset Loop over Interactions
theInteractions.clearAndDestroy();
// --- cms energy
G4double s = sqr( thePrimary.GetMass() ) +
sqr( G4Proton::Proton()->GetPDGMass() ) +
2*thePrimary.GetTotalEnergy()*G4Proton::Proton()->GetPDGMass();
// G4cout << " primary Total E (GeV): " << thePrimary.GetTotalEnergy()/GeV << endl;
// G4cout << " primary Mass (GeV): " << thePrimary.GetMass() /GeV << endl;
// G4cout << "cms sqrt(s) (GeV) = " << sqrt(s) / GeV << endl;
G4PomeronCrossSection theCrossSection(thePrimary.GetDefinition());
G4double deltaxy=2 * fermi;
G4VSplitableHadron * primarySplitable=new G4DiffractiveSplitableHadron(thePrimary);
G4double xyradius;
xyradius =theNucleus->GetOuterRadius() + deltaxy;
// G4cout <<" G4FTFParticipants::StartLoop: xyradius " << xyradius << endl;
G4bool nucleusNeedsShift = true;
while ( theInteractions.entries() == 0 )
{
G4double x,y;
do
{
x=2*G4UniformRand()-1;
y=2*G4UniformRand()-1;
} while ( (sqr(x) + sqr(y)) > 1 );
G4double impactX=x*xyradius;
G4double impactY=y*xyradius;
// G4cout << " impctX, impctY " << impactX/fermi << " "<<impactY/fermi << " fm" << endl;
theNucleus->StartLoop();
G4Nucleon * nucleon;
while ( nucleon=theNucleus->GetNextNucleon() )
{
G4double impact2= sqr(impactX - nucleon->GetPosition().x()) +
sqr(impactY - nucleon->GetPosition().y());
if ( theCrossSection.GetInelasticProbability(s,impact2)
> G4UniformRand() )
{
if ( nucleusNeedsShift )
{ // on the first hit, shift nucleus
nucleusNeedsShift = false;
theNucleus->DoTranslation(G4ThreeVector(-1*impactX,-1*impactY,0.));
impactX=0;
impactY=0;
}
G4VSplitableHadron * targetSplitable;
if ( (targetSplitable=nucleon->GetSplitableHadron()) == NULL )
{
targetSplitable= new G4DiffractiveSplitableHadron(*nucleon);
nucleon->Hit(targetSplitable);
}
G4InteractionContent * aInteraction = new G4InteractionContent(primarySplitable);
aInteraction->SetTarget(targetSplitable);
theInteractions.insert(aInteraction);
}
}
// G4cout << "Number of Hit nucleons " << theInteractions.entries()
// << "\t" << impactX/fermi << "\t"<<impactY/fermi
// << "\t" << sqrt(sqr(impactX)+sqr(impactY))/fermi <<endl;
}
}
// Implementation (private) methods