Import Geant4 1.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 15:28:20 +02:00
parent aaa409b6ee
commit ca1c8cb059
2995 changed files with 106830 additions and 299600 deletions
@@ -0,0 +1,41 @@
# $Id: GNUmakefile,v 1.1 1999/01/08 16:33:14 gunter Exp $
# -----------------------------------------------------------
# GNUmakefile for hadronic library. Gabriele Cosmo, 18/9/96.
# -----------------------------------------------------------
name := G4hadronic_qgstring
ifndef G4INSTALL
G4INSTALL = ../../../../../..
endif
include $(G4INSTALL)/config/architecture.gmk
G4TMPDIR = $(G4TMP)/$(G4SYSTEM)/$(name)
CPPFLAGS += -I$(G4BASE)/global/management/include \
-I$(G4BASE)/global/HEPRandom/include \
-I$(G4BASE)/global/HEPNumerics/include \
-I$(G4BASE)/global/HEPGeometry/include \
-I$(G4BASE)/track/include \
-I$(G4BASE)/geometry/volumes/include \
-I$(G4BASE)/geometry/management/include \
-I$(G4BASE)/processes/management/include \
-I$(G4BASE)/processes/hadronic/management/include/ \
-I$(G4BASE)/processes/hadronic/util/include \
-I$(G4BASE)/processes/hadronic/processes/include \
-I$(G4BASE)/processes/hadronic/cross_sections/include \
-I$(G4BASE)/processes/hadronic/models/generator/management/include \
-I$(G4BASE)/processes/hadronic/models/generator/string_common/include \
-I$(G4BASE)/processes/hadronic/models/generator/util/include \
-I$(G4BASE)/particles/management/include \
-I$(G4BASE)/particles/leptons/include \
-I$(G4BASE)/particles/bosons/include \
-I$(G4BASE)/particles/hadrons/mesons/include \
-I$(G4BASE)/particles/hadrons/barions/include \
-I$(G4BASE)/particles/hadrons/ions/include \
-I$(G4BASE)/particles/shortlived/include \
-I$(G4BASE)/materials/include
include $(G4INSTALL)/config/common.gmk
@@ -0,0 +1,24 @@
#ifndef G4BaryonSplitter_h
#define G4BaryonSplitter_h
// HPW Feb1999 based on prototype, needs urgent clean-up of data structures.
// Also needs clean-up of interfaces.
// @@@@@@@@@@@@@@@@@
// clean-up of data structures
#include "globals.hh"
#include "G4SPBaryonTable.hh"
class G4BaryonSplitter
{
public:
G4BaryonSplitter();
G4bool SplitBarion(G4int Encoding, G4int* q_or_qqbar, G4int* qbar_or_qq);
G4bool FindDiquark(G4int Encoding, G4int Quark, G4int* Diquark);
private:
G4SPBaryonTable theBaryons;
};
#endif
@@ -0,0 +1,34 @@
#ifndef G4DiffractiveStringBuilder_h
#define G4DiffractiveStringBuilder_h 1
#include "globals.hh"
#include "G4KineticTrackVector.hh"
#include "G4ExcitedStringVector.hh"
#include "G4PartonPair.hh"
class G4DiffractiveStringBuilder
{
public:
G4DiffractiveStringBuilder();
G4DiffractiveStringBuilder(const G4DiffractiveStringBuilder &right);
~G4DiffractiveStringBuilder();
int operator==(const G4DiffractiveStringBuilder &right) const;
int operator!=(const G4DiffractiveStringBuilder &right) const;
G4ExcitedString* BuildString(G4PartonPair* aParton);
private:
};
inline int G4DiffractiveStringBuilder::operator==(const G4DiffractiveStringBuilder &right) const
{
return 1;
}
inline int G4DiffractiveStringBuilder::operator!=(const G4DiffractiveStringBuilder &right) const
{
return 0;
}
#endif
@@ -0,0 +1,53 @@
// This code implementation is the intellectual property of
// the 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: G4InelasticSplitableHadron.hh,v 1.1.4.1 1999/12/07 20:51:50 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
#ifndef G4InelasticSplitableHadron_h
#define G4InelasticSplitableHadron_h 1
#include "G4VSplitableHadron.hh"
class G4InelasticSplitableHadron : public G4VSplitableHadron
{
public:
G4InelasticSplitableHadron(const G4ReactionProduct & aPrimary);
G4InelasticSplitableHadron(const G4Nucleon & aNucleon);
~G4InelasticSplitableHadron();
int operator==(const G4InelasticSplitableHadron &right) const;
int operator!=(const G4InelasticSplitableHadron &right) const;
void SplitUp();
G4Parton * GetNextParton() ;
private:
G4InelasticSplitableHadron();
G4InelasticSplitableHadron(const G4InelasticSplitableHadron &right);
const G4InelasticSplitableHadron & operator=(const G4InelasticSplitableHadron &right);
//implementation
void GetValenceQuarkFlavors(G4int PDGcode, G4int& aEnd, G4int& bEnd);
G4int Diquark(G4int aquark,G4int bquark,G4int Spin) const; // to splitable hadron
private:
G4Parton *Parton[2];
G4int PartonIndex;
G4double udspin1; // 1./6.
G4double uuspin1; // 1./3.
G4double udspin0; // 1./2.
};
#endif
@@ -0,0 +1,20 @@
#ifndef G4MesonSplitter_h
#define G4MesonSplitter_h
// HPW Feb 1999, based on Annihilator prototype.
// Simple class to split a meson, only one trivial method at the moment
// liable for improvement. @@@
// interfaces need change. @@@
#include "globals.hh"
class G4MesonSplitter
{
public:
G4bool SplitMeson(G4int PDGcode, G4int* aEnd, G4int* bEnd);
private:
};
#endif
@@ -0,0 +1,89 @@
#ifndef G4PartonPair_h
#define G4PartonPair_h 1
#include "globals.hh"
#include "G4ThreeVector.hh"
#include "G4LorentzVector.hh"
#include "G4Parton.hh"
#include "G4PartonVector.hh"
class G4PartonPair
{
public:
enum {
DIFFRACTIVE = 1,
SOFT = 2,
HARD = 3
};
enum
{
PROJECTILE = 1,
TARGET = -1
};
public:
G4PartonPair(G4Parton* P1, G4Parton* P2, G4int Type, G4int Direction);
G4PartonPair(const G4PartonPair &right);
~G4PartonPair();
int operator==(const G4PartonPair &right) const;
int operator!=(const G4PartonPair &right) const;
void SetPartons(G4Parton* P1, G4Parton* P2);
void SetCollisionType(G4int Type);
G4int GetCollisionType();
G4Parton* GetParton1(void);
G4Parton* GetParton2(void);
G4int GetDirection();
private:
G4Parton* Parton1;
G4Parton* Parton2;
G4int CollisionType;
G4int Direction;
};
inline int G4PartonPair::operator==(const G4PartonPair &right) const
{
return (CollisionType == right.CollisionType &&
*Parton1 == *right.Parton1 &&
*Parton2 == *right.Parton2)? 1: 0;
}
inline int G4PartonPair::operator!=(const G4PartonPair &right) const
{
return (CollisionType == right.CollisionType &&
*Parton1 == *right.Parton1 &&
*Parton2 == *right.Parton2)? 0: 1;
}
inline G4Parton* G4PartonPair::GetParton1(void)
{
return Parton1;
}
inline G4Parton* G4PartonPair::GetParton2(void)
{
return Parton2;
}
inline void G4PartonPair::SetCollisionType(G4int Type)
{
CollisionType = Type;
}
inline G4int G4PartonPair::GetCollisionType()
{
return CollisionType;
}
inline G4int G4PartonPair::GetDirection()
{
return Direction;
}
#endif
@@ -0,0 +1,71 @@
// This code implementation is the intellectual property of
// the 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: G4PartonStringAnnihilator.hh,v 1.1.4.1 1999/12/07 20:51:51 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $Maxim Komogorov
// -----------------------------------------------------------------------------
// GEANT 4 class implementation file
//
// For information related to this code contact:
// CERN, CN Division, ASD Group
// History: first implementation, Maxim Komogorov, 9-Oct-1998
// -----------------------------------------------------------------------------
#ifndef G4PartonStringAnnihilator_h
#define G4PartonStringAnnihilator_h 1
#include "G4KineticTrackVector.hh"
#include "G4ExcitedString.hh"
#include "G4MesonSplitter.hh"
// **************************************************************************************************
// Barion consists from Quark and Diquark with given spin-isospin state.
// Different barion states are defined by Probability
struct G4ACSParameters
{
G4int ProjectileEncoding;
G4int TargetEncoding;
G4double X;
G4double Y;
G4double Eta;
G4double Epsilon;
};
// **************************************************************************************************
class G4PartonStringAnnihilator
{
public:
G4PartonStringAnnihilator();
~G4PartonStringAnnihilator();
static G4ACSParameters ACSParametersTable[];
public:
G4bool IsAnnihilation(G4KineticTrackVector& aTarget, G4KineticTrackVector& aProjectile, G4double* CrossSection);
G4ExcitedString* Annihilator(G4KineticTrack& Target, G4KineticTrack& Projectile);
private:
// void GetValenceQuarkFlavors(G4int PDGcode, G4int& aEnd, G4int& bEnd);
G4bool AnnihilatorEncoding(G4int Projectile, G4int Target, G4int* Left, G4int* Right);
G4bool FindDiquark(G4int Encoding, G4int Quark, G4int* Diquark);
G4bool FindQuark(G4int Encoding, G4int Diquark, G4int* Quark);
public:
G4bool SplitUpBarion(G4int Encoding, G4int* q_or_qqbar, G4int* qbar_or_qq); //!
G4bool isMeson(G4int Encoding);
G4bool isBarion(G4int Encoding);
G4bool isAntiParticle(G4int Encoding);
private:
G4double widthOfPtSquare;
G4MesonSplitter theMesonSplitter;
};
// *************************************************************************************************
#endif
@@ -0,0 +1,28 @@
#ifndef G4QGSMParameters_h
#define G4QGSMParameters_h 1
#include "globals.hh"
class G4QGSMParameters
{
public:
G4QGSMParameters();
G4QGSMParameters(const G4QGSMParameters &right);
~G4QGSMParameters();
int operator==(const G4QGSMParameters &right) const;
int operator!=(const G4QGSMParameters &right) const;
private:
};
inline int G4QGSMParameters::operator==(const G4QGSMParameters &right) const
{
return 1;
}
inline int G4QGSMParameters::operator!=(const G4QGSMParameters &right) const
{
return 0;
}
#endif
@@ -0,0 +1,75 @@
#ifndef G4QGSMSplitableHadron_h
#define G4QGSMSplitableHadron_h 1
#include "G4VSplitableHadron.hh"
#include "G4PartonVector.hh"
#include "G4MesonSplitter.hh"
#include "G4BaryonSplitter.hh"
#include "Randomize.hh"
// based on prototype by Maxim Komogorov
// Splitting into methods, and centralizing of model parameters HPW Feb 1999
// continued clean-up of interfaces and algorithms HPW 1999.
// Redesign of data structures and algorithms HPW Feb 1999
class G4QGSMSplitableHadron : public G4VSplitableHadron
{
public:
G4QGSMSplitableHadron();
G4QGSMSplitableHadron(const G4ReactionProduct & aPrimary);
G4QGSMSplitableHadron(const G4ReactionProduct & aPrimary, G4bool Direction);
G4QGSMSplitableHadron(const G4Nucleon & aNucleon);
virtual ~G4QGSMSplitableHadron();
const G4QGSMSplitableHadron & operator=(const G4QGSMSplitableHadron &right);
virtual void SplitUp();
virtual G4Parton * GetNextParton();
virtual G4Parton * GetNextAntiParton();
private:
void InitParameters();
void DiffractiveSplitUp();
void SoftSplitUp();
G4ThreeVector GaussianPt(G4double widthSquare, G4double maxPtSquare);
void GetValenceQuarkFlavors(const G4ParticleDefinition * aPart,
G4Parton *& Parton1, G4Parton *& Parton2);
G4Parton * BuildSeaQuark(G4bool isAntiQuark, G4int aPDGCode, G4int nSeaPair);
G4double SampleX(G4double anXmin, G4int nSea, G4int theTotalSea, G4double aBeta);
private:
// aggregated data
G4bool Direction; // FALSE is target. - candidate for more detailed design. @@@@ HPW
G4PartonVector Color;
G4PartonVector AntiColor;
private:
// associated classes
G4MesonSplitter theMesonSplitter;
G4BaryonSplitter theBaryonSplitter;
private:
// model parameters
double alpha;
double beta;
double theMinPz;
double StrangeSuppress;
double sigmaPt;
double widthOfPtSquare;
};
inline G4Parton* G4QGSMSplitableHadron::GetNextParton()
{
return Color.isEmpty()?0:Color.removeLast();
}
inline G4Parton* G4QGSMSplitableHadron::GetNextAntiParton()
{
return AntiColor.isEmpty()?0:AntiColor.removeFirst();
}
#endif
@@ -0,0 +1,54 @@
#ifndef G4QGSModel_h
#define G4QGSModel_h 1
#include "G4ExcitedStringVector.hh"
#include "G4KineticTrackVector.hh"
#include "G4PomeronCrossSection.hh"
#include "G4ParticleTable.hh"
#include "G4Fancy3DNucleus.hh"
#include "G4VPartonStringModel.hh"
#include "G4QGSParticipants.hh"
#include "G4DiffractiveStringBuilder.hh"
#include "G4SoftStringBuilder.hh"
#include "G4PartonPair.hh"
//***********************************************************************************************
//*****************************************************************************************
class G4QGSModel : public G4VPartonStringModel
{
// Constructors
public:
G4QGSModel();
G4QGSModel(const G4QGSModel &right);
virtual ~G4QGSModel();
// Method
public:
virtual G4V3DNucleus* GetWoundedNucleus() const;
protected:
virtual void Init(const G4Nucleus& Nucleus, const G4DynamicParticle& Projectile);
virtual G4ExcitedStringVector * GetStrings();
private:
G4QGSParticipants theParticipants;
G4DiffractiveStringBuilder theDiffractiveStringBuilder;
G4SoftStringBuilder theSoftStringBuilder;
private:
// cash theCurrentVelocity for lorentztrafo HPW
G4ThreeVector theCurrentVelocity;
};
//-------------------------------------------------------------------------------------------
//*****************************************************************************************
#endif
@@ -0,0 +1,84 @@
#ifndef G4QGSParticipants_h
#define G4QGSParticipants_h 1
#include "Randomize.hh"
#include "G4VParticipants.hh"
#include "G4Nucleon.hh"
#include "G4InteractionContent.hh"
#include "G4PomeronCrossSection.hh"
#include "G4DiffractiveExcitation.hh"
#include "G4SingleDiffractiveExcitation.hh"
#include "G4PartonPair.hh"
#include "G4QGSMSplitableHadron.hh"
class G4QGSParticipants : public G4VParticipants
{
enum { SOFT, HARD, DIFFRACTIVE };
public:
G4QGSParticipants();
G4QGSParticipants(const G4QGSParticipants &right);
const G4QGSParticipants & operator=(const G4QGSParticipants &right);
~G4QGSParticipants();
int operator==(const G4QGSParticipants &right) const;
int operator!=(const G4QGSParticipants &right) const;
G4PartonPair* GetNextPartonPair();
void BuildInteractions(const G4ReactionProduct &thePrimary);
void StartPartonPairLoop();
private:
void SplitHadrons();
void PerformSoftCollisions();
void PerformDiffractiveCollisions();
private:
G4RWTPtrOrderedVector<G4InteractionContent> theInteractions;
G4RWTPtrOrderedVector<G4VSplitableHadron> theTargets;
G4RWTPtrOrderedVector<G4PartonPair> thePartonPairs;
G4SingleDiffractiveExcitation theSingleDiffExcitation;
G4DiffractiveExcitation theDiffExcitaton;
G4int ModelMode;
G4bool IsSingleDiffractive();
private:
// model parameters HPW
const G4int nCutMax;
const G4double ThersholdParameter;
const G4double QGSMThershold;
const G4double theNucleonRadius;
};
inline G4bool G4QGSParticipants::IsSingleDiffractive()
{
G4bool result;
if(G4UniformRand()<1.) result = true;
return result;
}
inline void G4QGSParticipants::StartPartonPairLoop()
{
}
inline G4PartonPair* G4QGSParticipants::GetNextPartonPair()
{
if (thePartonPairs.isEmpty()) return 0;
return thePartonPairs.removeLast();
}
inline void G4QGSParticipants::SplitHadrons()
{
G4int i;
for(i = 0; i < theInteractions.length(); i++)
{
theInteractions.at(i)->SplitHadrons();
}
}
#endif
@@ -0,0 +1,63 @@
#ifndef G4SPBaryon_h
#define G4SPBaryon_h
#include "globals.hh"
#include "G4Proton.hh"
#include "G4Neutron.hh"
#include "G4SigmaPlus.hh"
#include "G4SigmaZero.hh"
#include "G4SigmaMinus.hh"
#include "G4XiMinus.hh"
#include "G4XiZero.hh"
#include "G4Lambda.hh"
#include "G4OmegaMinus.hh"
#include "G4ParticleDefinition.hh"
#include "g4rw/tpordvec.h"
#include "globals.hh"
class G4SPBaryon
{
public:
G4SPBaryon(G4Proton * aProton);
G4SPBaryon(G4Neutron * aNeutron);
G4SPBaryon(G4SigmaPlus * aSigmaPlus);
G4SPBaryon(G4SigmaZero * aSigmaZero);
G4SPBaryon(G4SigmaMinus * aSigmaMinus);
G4SPBaryon(G4XiMinus * aXiMinus);
G4SPBaryon(G4XiZero * aXiZero);
G4SPBaryon(G4Lambda * aLambda);
G4SPBaryon(G4OmegaMinus * anOmegaMinus);
G4SPBaryon(G4ParticleDefinition * aDefinition);
G4bool operator == ( const G4SPBaryon & aBaryon)
{return this == &aBaryon; }
G4ParticleDefinition * GetDefinition() {return theDefinition;}
void SampleQuarkAndDiquark(G4int & quark, G4int & diQuark) const;
void FindDiquark(G4int quark, G4int & diQuark) const;
private:
class G4SPPartonInfo
{
public:
G4SPPartonInfo(G4int diq, G4int q, G4double prob)
{ diQuarkPDGCode = diq; quarkPDGCode = q; probability = prob; }
G4int GetQuark() const {return quarkPDGCode;}
G4int GetDiQuark() const {return diQuarkPDGCode;}
G4double GetProbability() const {return probability;}
G4bool operator == (const G4SPPartonInfo & aInfo) const
{return this == &aInfo;}
private:
G4int quarkPDGCode;
G4int diQuarkPDGCode;
G4double probability;
};
private:
G4ParticleDefinition * theDefinition;
G4RWTPtrOrderedVector<G4SPPartonInfo> thePartonInfo;
};
#endif
@@ -0,0 +1,35 @@
#ifndef G4SPBaryonTable_h
#define G4SPBaryonTable_h
#include "g4rw/tpordvec.h"
#include "G4SPBaryon.hh"
class G4SPBaryonTable
{
public:
void insert(G4SPBaryon * aBaryon) { theBaryons.insert(aBaryon);}
G4double length() {return theBaryons.length();}
const G4SPBaryon * GetBaryon(G4ParticleDefinition * aDefinition);
private:
G4RWTPtrOrderedVector<G4SPBaryon> theBaryons;
};
inline const G4SPBaryon * G4SPBaryonTable::
GetBaryon(G4ParticleDefinition * aDefinition)
{
G4SPBaryon * result = 0;
for(G4int i=0; i<theBaryons.length(); i++)
{
if(theBaryons[i]->GetDefinition()==aDefinition)
{
result = theBaryons[i];
break;
}
}
return result;
}
#endif
@@ -0,0 +1,35 @@
#ifndef G4SoftStringBuilder_h
#define G4SoftStringBuilder_h 1
#include "globals.hh"
#include "G4KineticTrackVector.hh"
#include "G4ExcitedStringVector.hh"
#include "G4PartonPair.hh"
class G4SoftStringBuilder
{
public:
G4SoftStringBuilder();
G4SoftStringBuilder(const G4SoftStringBuilder &right);
~G4SoftStringBuilder();
int operator==(const G4SoftStringBuilder &right) const;
int operator!=(const G4SoftStringBuilder &right) const;
G4ExcitedString* BuildString(G4PartonPair * aPair);
private:
};
inline int G4SoftStringBuilder::operator==(const G4SoftStringBuilder &right) const
{
return 1;
}
inline int G4SoftStringBuilder::operator!=(const G4SoftStringBuilder &right) const
{
return 0;
}
#endif
@@ -0,0 +1,75 @@
// Split barion (antibarion) into quark and diquark (antidiquark and antiqaurk )
// based on prototype, needs clean up of interfaces HPW Feb 1999
#include "G4BaryonSplitter.hh"
#include "G4ParticleTable.hh"
G4BaryonSplitter::
G4BaryonSplitter()
{
theBaryons.insert(new G4SPBaryon(G4Proton::Proton()));
theBaryons.insert(new G4SPBaryon(G4Neutron::Neutron()));
theBaryons.insert(new G4SPBaryon(G4SigmaPlus::SigmaPlus()));
theBaryons.insert(new G4SPBaryon(G4SigmaZero::SigmaZero()));
theBaryons.insert(new G4SPBaryon(G4SigmaMinus::SigmaMinus()));
theBaryons.insert(new G4SPBaryon(G4XiMinus::XiMinus()));
theBaryons.insert(new G4SPBaryon(G4XiZero::XiZero()));
theBaryons.insert(new G4SPBaryon(G4Lambda::Lambda()));
theBaryons.insert(new G4SPBaryon(G4OmegaMinus::OmegaMinus()));
theBaryons.insert(new G4SPBaryon(G4ParticleTable::GetParticleTable()->FindParticle(2224))); // D++
theBaryons.insert(new G4SPBaryon(G4ParticleTable::GetParticleTable()->FindParticle(2214))); // D+
theBaryons.insert(new G4SPBaryon(G4ParticleTable::GetParticleTable()->FindParticle(2114))); // D0
theBaryons.insert(new G4SPBaryon(G4ParticleTable::GetParticleTable()->FindParticle(1114))); // D-
theBaryons.insert(new G4SPBaryon(G4ParticleTable::GetParticleTable()->FindParticle(3224))); // S+*
theBaryons.insert(new G4SPBaryon(G4ParticleTable::GetParticleTable()->FindParticle(3214))); // S0*
theBaryons.insert(new G4SPBaryon(G4ParticleTable::GetParticleTable()->FindParticle(3224))); // S-*
theBaryons.insert(new G4SPBaryon(G4ParticleTable::GetParticleTable()->FindParticle(3324))); // X0*
theBaryons.insert(new G4SPBaryon(G4ParticleTable::GetParticleTable()->FindParticle(3314))); // X-*
}
G4bool G4BaryonSplitter::
SplitBarion(G4int Encoding, G4int* q_or_qqbar, G4int* qbar_or_qq)
{
const G4SPBaryon * aBaryon = theBaryons.GetBaryon(G4ParticleTable::GetParticleTable()->FindParticle(Encoding));
if(aBaryon==NULL)
{
return FALSE;
}
else
{
aBaryon->SampleQuarkAndDiquark(*q_or_qqbar, *qbar_or_qq);
return TRUE;
}
}
// Find rest diquark in given barion after quark - antiquark annihilation
G4bool G4BaryonSplitter::
FindDiquark(G4int Encoding, G4int Quark, G4int* Diquark)
{
const G4SPBaryon * aBaryon = theBaryons.GetBaryon(G4ParticleTable::GetParticleTable()->FindParticle(Encoding));
if(aBaryon==NULL)
{
return FALSE;
}
else
{
aBaryon->FindDiquark(Quark, *Diquark);
return TRUE;
}
}
//const CBarionState * G4BaryonSplitter::
//FindBaryonComposition(PDGCode)
//{
// CBarionState * result = NULL;
// G4int AbsPDGCode = abs(PDGCode);
// for(G4int i = 0; i < sizeof(BarionContentTable)/sizeof(CBarionContent); i++)
// {
// if (BarionContentTable[i].AbsEncoding == AbsPDGCode)
// {
// result = BarionContentTable[i].Content;
// break;
// }
// }
// return result;
//}
@@ -0,0 +1,22 @@
#include "G4DiffractiveStringBuilder.hh"
//***************************************************************************************************
G4DiffractiveStringBuilder::G4DiffractiveStringBuilder()
{
}
G4DiffractiveStringBuilder::G4DiffractiveStringBuilder(const G4DiffractiveStringBuilder &right)
{
}
G4DiffractiveStringBuilder::~G4DiffractiveStringBuilder()
{
}
//***************************************************************************************************
G4ExcitedString* G4DiffractiveStringBuilder::BuildString(G4PartonPair * aPair)
{
return new G4ExcitedString(aPair->GetParton1(), aPair->GetParton2(), aPair->GetDirection());
}
@@ -0,0 +1,144 @@
#include "G4InelasticSplitableHadron.hh"
#include "G4ParticleDefinition.hh"
#include "G4Parton.hh"
#include "Randomize.hh"
G4InelasticSplitableHadron::G4InelasticSplitableHadron()
{
udspin1 = 1./6.;
uuspin1 = 1./3.;
udspin0 = 1./2.;
}
G4InelasticSplitableHadron::G4InelasticSplitableHadron(const G4ReactionProduct & aPrimary)
: G4VSplitableHadron(aPrimary)
{
PartonIndex=-2;
Parton[0]=NULL;
}
G4InelasticSplitableHadron::G4InelasticSplitableHadron(const G4Nucleon & aNucleon)
: G4VSplitableHadron(aNucleon)
{
PartonIndex=-2;
Parton[0]=NULL;
}
G4InelasticSplitableHadron::~G4InelasticSplitableHadron()
{}
const G4InelasticSplitableHadron & G4InelasticSplitableHadron::operator=(const G4InelasticSplitableHadron &right)
{
G4Exception("G4InelasticSplitableHadron::operator= meant to not be accessable");
return *this;
}
//***********************************************************************************************
void G4InelasticSplitableHadron::SplitUp()
{
// Split once only...
if (Parton[0] != NULL) return;
// flavours of quark ends
G4int PDGcode=GetDefinition()->GetPDGEncoding();
G4int stringStart, stringEnd;
GetValenceQuarkFlavors(PDGcode, stringStart,stringEnd);
Parton[0] = new G4Parton(stringStart);
Parton[1] = new G4Parton(stringEnd);
PartonIndex=-1;
}
G4Parton * G4InelasticSplitableHadron::GetNextParton()
{
++PartonIndex;
if ( PartonIndex > 1 || PartonIndex < 0 ) return NULL;
return Parton[PartonIndex];
}
//
//----------------------- Implementation--------------------------
//
void G4InelasticSplitableHadron::GetValenceQuarkFlavors(G4int PDGcode, G4int& aEnd, G4int& bEnd)
{
// Note! convention aEnd = q or qqbar and bEnd = qbar or qq.
G4int absPDGcode = abs(PDGcode);
if (absPDGcode < 1000)
{
G4int heavy = absPDGcode/100;
G4int light = (absPDGcode%100)/10;
G4int anti = 1 - 2*(max(heavy, light)%2);
if (PDGcode < 0 ) anti = -anti;
heavy *= anti;
light *= -1 * anti;
if ( heavy > 0)
{
aEnd=heavy;
bEnd=light;
}
else
{
aEnd=light;
bEnd=heavy;
}
return;
}
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 = j100 + j10 + 1;
}
else if ( random < (udspin1 + uuspin1) )
{
aEnd = j10;
bEnd = j1000 + j100 + 1;
}
else
{
aEnd = j100;
bEnd = j1000 + j10 + 0;
}
if (aEnd < 0)
{
G4int Swap = aEnd;
aEnd = bEnd;
bEnd = aEnd;
}
return;
}
// Lambda-like hadrons have two lightest quarks in spin 0
if ( random < udspin1 )
{
aEnd = j1000;
bEnd = j100 + j10 + 0;
}
else if ( random < (udspin1 + uuspin1) )
{
aEnd = j10;
bEnd = j1000 + j100 + 1;
}
else
{
aEnd = j100;
bEnd = j1000 + j10 + 1;
}
if (aEnd < 0)
{
G4int Swap = aEnd;
aEnd = bEnd;
bEnd = aEnd;
}
}
//***********************************************************************************************
@@ -0,0 +1,19 @@
#include "G4MesonSplitter.hh"
G4bool G4MesonSplitter::SplitMeson(G4int PDGcode, G4int* aEnd, G4int* bEnd)
{
G4int absPDGcode = abs(PDGcode);
if (absPDGcode >= 1000) return FALSE;
G4int heavy = absPDGcode/100;
G4int light = (absPDGcode%100)/10;
G4int anti = 1 - 2*(max(heavy, light)%2);
if (PDGcode < 0 ) anti = -anti;
heavy *= anti;
light *= -anti;
if ( anti < 0)
G4SwapObj(&heavy, &light);
*aEnd = heavy;
*bEnd = light;
return TRUE;
}
@@ -0,0 +1,21 @@
#include "G4PartonPair.hh"
G4PartonPair::G4PartonPair(G4Parton* P1, G4Parton* P2, G4int Type, G4int aDirection)
{
CollisionType = Type;
Parton1 = P1;
Parton2 = P2;
Direction = aDirection;
}
G4PartonPair::G4PartonPair(const G4PartonPair &right)
{
G4Exception("You can not make a copy of this object");
}
G4PartonPair::~G4PartonPair()
{
delete Parton1;
delete Parton2;
}
@@ -0,0 +1,13 @@
#include "G4QGSMParameters.hh"
G4QGSMParameters::G4QGSMParameters()
{
}
G4QGSMParameters::G4QGSMParameters(const G4QGSMParameters &right)
{
}
G4QGSMParameters::~G4QGSMParameters()
{
}
@@ -0,0 +1,306 @@
#include "G4QGSMSplitableHadron.hh"
#include "G4ParticleTable.hh"
#include "G4PionPlus.hh"
#include "G4PionMinus.hh"
#include "G4PionZero.hh"
#include "G4KaonPlus.hh"
#include "G4KaonMinus.hh"
// based on prototype by Maxim Komogorov
// Splitting into methods, and centralizing of model parameters HPW Feb 1999
// restructuring HPW Feb 1999
// fixing bug in the sampling of 'x', HPW Feb 1999
// fixing bug in sampling pz, HPW Feb 1999.
// Code now also good for p-nucleus scattering (before only p-p), HPW Feb 1999.
// Using Parton more directly, HPW Feb 1999.
// Shortening the algorithm for sampling x, HPW Feb 1999.
// sampling of x replaced by formula, taking X_min into account in the correlated sampling. HPW, Feb 1999.
// logic much clearer now. HPW Feb 1999
// Removed the ordering problem. No Direction needed in selection of valence quark types. HPW Mar'99.
// Fixing p-t distributions for scattering of nuclei.
// Separating out parameters.
void G4QGSMSplitableHadron::InitParameters()
{
alpha = -0.5; // Note that this number is still assumed in the algorithm
// needs to be generalized.
beta = 2.5;// Note that this number is still assumed in the algorithm
// needs to be generalized.
// theMinPz = 0.5*G4PionMinus::PionMinus()->GetPDGMass();
theMinPz = 0.1*G4PionMinus::PionMinus()->GetPDGMass();
// as low as possible, otherwise, we have unphysical boundary conditions in the sampling.
StrangeSuppress = 0.48;
sigmaPt = 0.*GeV; // widens eta slightly, if increased to 1.7,
// but Maxim's original algorithm breaks energy conservation
// to be revised.
widthOfPtSquare = 0.01*GeV*GeV;
Direction = FALSE;
}
G4QGSMSplitableHadron::G4QGSMSplitableHadron()
{
InitParameters();
}
G4QGSMSplitableHadron::G4QGSMSplitableHadron(const G4ReactionProduct & aPrimary, G4bool aDirection)
:G4VSplitableHadron(aPrimary)
{
InitParameters();
Direction = aDirection;
}
G4QGSMSplitableHadron::G4QGSMSplitableHadron(const G4ReactionProduct & aPrimary)
: G4VSplitableHadron(aPrimary)
{
InitParameters();
}
G4QGSMSplitableHadron::G4QGSMSplitableHadron(const G4Nucleon & aNucleon)
: G4VSplitableHadron(aNucleon)
{
InitParameters();
}
G4QGSMSplitableHadron::~G4QGSMSplitableHadron(){}
const G4QGSMSplitableHadron & G4QGSMSplitableHadron::operator=(const G4QGSMSplitableHadron &right)
{
G4Exception("G4QGSMSplitableHadron::operator= meant to not be accessable");
return *this;
}
//**************************************************************************************************************************
void G4QGSMSplitableHadron::SplitUp()
{
if (!Color.isEmpty()) return;
if (GetSoftCollisionCount() == 0)
{
DiffractiveSplitUp();
}
else
{
SoftSplitUp();
}
}
void G4QGSMSplitableHadron::DiffractiveSplitUp()
{
// take the particle definitions and get the partons HPW
G4Parton * Left = NULL;
G4Parton * Right = NULL;
GetValenceQuarkFlavors(GetDefinition(), Left, Right);
Left->SetPosition(GetPosition());
Right->SetPosition(GetPosition());
G4LorentzVector HadronMom = Get4Momentum();
// momenta of string ends
G4double pt2 = HadronMom.perp2();
G4double transverseMass2 = HadronMom.plus()*HadronMom.minus();
G4double maxAvailMomentum2 = sqr(sqrt(transverseMass2) - sqrt(pt2));
G4ThreeVector pt = GaussianPt(widthOfPtSquare, maxAvailMomentum2);
G4LorentzVector LeftMom(pt, 0.);
G4LorentzVector RightMom;
RightMom.setPx(HadronMom.px() - pt.x());
RightMom.setPy(HadronMom.py() - pt.y());
G4double Local1 = HadronMom.minus() + (RightMom.perp2() - LeftMom.perp2())/HadronMom.plus();
G4double Local2 = sqrt(max(0., sqr(Local1) - 4.*RightMom.perp2()*HadronMom.minus()/HadronMom.plus()));
if (Direction) Local2 = -Local2;
G4double RightMinus = 0.5*(Local1 + Local2);
G4double LeftMinus = HadronMom.minus() - RightMinus;
G4double LeftPlus = LeftMom.perp2()/LeftMinus;
G4double RightPlus = HadronMom.plus() - LeftPlus;
LeftMom.setPz(0.5*(LeftPlus - LeftMinus));
LeftMom.setE (0.5*(LeftPlus + LeftMinus));
RightMom.setPz(0.5*(RightPlus - RightMinus));
RightMom.setE (0.5*(RightPlus + RightMinus));
Left->Set4Momentum(LeftMom);
Right->Set4Momentum(RightMom);
Color.insert(Left);
AntiColor.insert(Right);
}
void G4QGSMSplitableHadron::SoftSplitUp()
{
//... sample transversal momenta for sea and valence quarks
G4double phi, pts;
G4double SumPy = 0.;
G4double SumPx = 0.;
G4ThreeVector Pos = GetPosition();
G4int nSeaPair = GetSoftCollisionCount()-1;
G4int aSeaPair;
for (aSeaPair = 0; aSeaPair < nSeaPair; aSeaPair++)
{
G4int aPDGCode = 1 + (G4int)(G4UniformRand()/StrangeSuppress);
G4Parton * aParton = BuildSeaQuark(false, aPDGCode, nSeaPair);
SumPx += aParton->Get4Momentum().px();
SumPy += aParton->Get4Momentum().py();
Color.insert(aParton);
aParton = BuildSeaQuark(true, aPDGCode, nSeaPair);
SumPx += aParton->Get4Momentum().px();
SumPy += aParton->Get4Momentum().py();
AntiColor.insert(aParton);
}
// Valence quark
G4Parton* pColorParton = NULL;
G4Parton* pAntiColorParton = NULL;
GetValenceQuarkFlavors(GetDefinition(), pColorParton, pAntiColorParton);
G4int ColorEncoding = pColorParton->GetPDGcode();
G4int AntiColorEncoding = pAntiColorParton->GetPDGcode();
pts = sigmaPt*sqrt(-log(G4UniformRand()));
phi = 2.*pi*G4UniformRand();
G4double Px = pts*cos(phi);
G4double Py = pts*sin(phi);
SumPx += Px;
SumPy += Py;
if (ColorEncoding < 0) // use particle definition
{
G4LorentzVector ColorMom(-SumPx, -SumPy, 0, 0);
pColorParton->Set4Momentum(ColorMom);
G4LorentzVector AntiColorMom(Px, Py, 0, 0);
pAntiColorParton->Set4Momentum(AntiColorMom);
}
else
{
G4LorentzVector ColorMom(Px, Py, 0, 0);
pColorParton->Set4Momentum(ColorMom);
G4LorentzVector AntiColorMom(-SumPx, -SumPy, 0, 0);
pAntiColorParton->Set4Momentum(AntiColorMom);
}
Color.insert(pColorParton);
AntiColor.insert(pAntiColorParton);
// Sample X
G4double LightConeMomentum = (Direction)? Get4Momentum().plus() : Get4Momentum().minus();
G4double Xmin = theMinPz/LightConeMomentum;
G4int nAttempt = 0;
G4double SumX = 0;
G4double aBeta = beta;
G4double ColorX, AntiColorX;
G4double HPWtest = 0;
if (GetDefinition() == G4PionMinus::PionMinusDefinition()) aBeta = 1.;
if (GetDefinition() == G4PionPlus::PionPlusDefinition()) aBeta = 1.;
if (GetDefinition() == G4PionZero::PionZeroDefinition()) aBeta = 1.;
if (GetDefinition() == G4KaonPlus::KaonPlusDefinition()) aBeta = 0.;
if (GetDefinition() == G4KaonMinus::KaonMinusDefinition()) aBeta = 0.;
do
{
SumX = 0;
nAttempt++;
G4int NumberOfUnsampledSeaQuarks = 2*nSeaPair;
G4double beta1 = beta;
if (abs(ColorEncoding) <= 1000 && abs(AntiColorEncoding) <= 1000) beta1 = 1.; //... in a meson
ColorX = SampleX(Xmin, NumberOfUnsampledSeaQuarks, 2*nSeaPair, aBeta);
HPWtest = ColorX;
while (ColorX < Xmin || ColorX > 1.|| 1. - ColorX <= Xmin);
Color.last()->SetX(SumX = ColorX);// this is the valenz quark.
for(G4int aPair = 0; aPair < nSeaPair; aPair++)
{
NumberOfUnsampledSeaQuarks--;
ColorX = SampleX(Xmin, NumberOfUnsampledSeaQuarks, 2*nSeaPair, aBeta);
Color.at(aPair)->SetX(ColorX);
SumX += ColorX;
NumberOfUnsampledSeaQuarks--;
AntiColorX = SampleX(Xmin, NumberOfUnsampledSeaQuarks, 2*nSeaPair, aBeta);
AntiColor.at(aPair)->SetX(AntiColorX); // the 'sea' partons
SumX += AntiColorX;
if (1. - SumX <= Xmin) break;
}
}
while (1. - SumX <= Xmin);
AntiColor.last()->SetX(1. - SumX); // the di-quark takes the rest, then go to momentum
G4double lightCone = ((!Direction) ? Get4Momentum().minus() : Get4Momentum().plus());
for(aSeaPair = 0; aSeaPair < nSeaPair+1; aSeaPair++)
{
G4Parton* aParton = Color.at(aSeaPair);
aParton->DefineMomentumInZ(lightCone, Direction);
aParton = AntiColor.at(aSeaPair);
aParton->DefineMomentumInZ(lightCone, Direction);
}
//--DEBUG-- cout <<endl<<"XSAMPLE "<<HPWtest<<endl;
return;
}
void G4QGSMSplitableHadron::GetValenceQuarkFlavors(const G4ParticleDefinition * aPart, G4Parton *& Parton1, G4Parton *& Parton2)
{
// Note! convention aEnd = q or qqbar and bEnd = qbar or qq.
G4int aEnd;
G4int bEnd;
G4int HadronEncoding = aPart->GetPDGEncoding();
if (aPart->GetBaryonNumber() == 0)
{
theMesonSplitter.SplitMeson(HadronEncoding, &aEnd, &bEnd);
}
else
{
theBaryonSplitter.SplitBarion(HadronEncoding, &aEnd, &bEnd);
}
Parton1 = new G4Parton(aEnd);
Parton1->SetPosition(GetPosition());
Parton2 = new G4Parton(bEnd);
Parton2->SetPosition(GetPosition());
}
G4ThreeVector G4QGSMSplitableHadron::GaussianPt(G4double widthSquare, G4double maxPtSquare)
{
G4double R;
while((R = -widthSquare*log(G4UniformRand())) > maxPtSquare);
R = sqrt(R);
G4double phi = twopi*G4UniformRand();
return G4ThreeVector (R*cos(phi), R*sin(phi), 0.);
}
G4Parton * G4QGSMSplitableHadron::
BuildSeaQuark(G4bool isAntiQuark, G4int aPDGCode, G4int nSeaPair)
{
if (isAntiQuark) aPDGCode*=-1.;
G4Parton* result = new G4Parton(aPDGCode);
result->SetPosition(GetPosition());
G4ThreeVector aPtVector = GaussianPt(sigmaPt, DBL_MAX);
G4LorentzVector a4Momentum(aPtVector, 0);
result->Set4Momentum(a4Momentum);
return result;
}
G4double G4QGSMSplitableHadron::
SampleX(G4double anXmin, G4int nSea, G4int totalSea, G4double aBeta)
{
G4double result;
G4double x1, x2;
G4double ymax = 0;
for(G4int ii=0; ii<100; ii++)
{
G4double y = pow(1./G4double(ii), alpha);
y *= pow( pow(1-anXmin-totalSea*anXmin, alpha+1) - pow(anXmin, alpha+1), nSea);
y *= pow(1-anXmin-totalSea*anXmin, aBeta+1) - pow(anXmin, aBeta+1);
if(y>ymax) ymax = y;
}
G4double y;
do
{
x1 = -1.;
while(x1<anXmin||x1>=1-(totalSea+1)*anXmin) x1 = G4UniformRand();
y = pow(x1, alpha);
y *= pow( pow(1-x1-totalSea*anXmin, alpha+1) - pow(anXmin, alpha+1), nSea);
y *= pow(1-x1-totalSea*anXmin, aBeta+1) - pow(anXmin, aBeta+1);
x2 = ymax*G4UniformRand();
}
while(x2>y);
result = x1;
return result;
}
@@ -0,0 +1,77 @@
#include "G4QGSModel.hh"
#include <stdlib.h>
//****************************************************************************************************************
G4QGSModel::G4QGSModel()
{
G4VPartonStringModel::SetThisPointer(this);
}
G4QGSModel::G4QGSModel(const G4QGSModel &right)
{
G4VPartonStringModel::SetThisPointer(this);
}
G4QGSModel::~G4QGSModel()
{
}
void G4QGSModel::Init(const G4Nucleus & aNucleus, const G4DynamicParticle & aProjectile)
{
// clean-up and consistency with design, HPW Feb 1999
theParticipants.Init(aNucleus.GetN(),aNucleus.GetZ());
theCurrentVelocity.setX(0);
theCurrentVelocity.setY(0);
// HPW Feb 1999
// this is an approximation, neglecting the motion of nucleons in the nucleus & p,n mass differences. @@@
G4double vz = aProjectile.Get4Momentum().pz()/
(aProjectile.Get4Momentum().e() + G4Proton::Proton()->GetPDGMass());
//--DEBUG-- cout << "IncomingMomentum "<<aProjectile.Get4Momentum()<<endl;
theCurrentVelocity.setZ(vz);
theParticipants.GetWoundedNucleus()->DoLorentzBoost(-theCurrentVelocity);
G4LorentzVector Mom = aProjectile.Get4Momentum();
Mom.boost(-theCurrentVelocity);
G4ReactionProduct theProjectile;
theProjectile.SetDefinition(aProjectile.GetDefinition());
theProjectile.SetTotalEnergy(Mom.e());
theProjectile.SetMomentum(Mom);
//--DEBUG-- cout << "PreInteractionMomentum "<<Mom<<endl;
theParticipants.BuildInteractions(theProjectile);
theParticipants.GetWoundedNucleus()->DoLorentzBoost(theCurrentVelocity);
}
G4ExcitedStringVector * G4QGSModel::GetStrings()
{
// clean-up and consistancy with design, HPW Feb 1999
// also fixing a memory leak, removing unnecessary caching, and
// streamlining of logic
G4PartonPair* aPair;
G4ExcitedStringVector* theStrings = new G4ExcitedStringVector;
G4ExcitedString * aString;
while(aPair = theParticipants.GetNextPartonPair())
{
if (aPair->GetCollisionType() == G4PartonPair::DIFFRACTIVE)
{
aString = theDiffractiveStringBuilder.BuildString(aPair);
}
else
{
aString = theSoftStringBuilder.BuildString(aPair);
}
aString->Boost(theCurrentVelocity);
theStrings->insert(aString);
}
//--DEBUG-- cout << endl;
for(G4int i=0; i<theStrings->length(); i++)
{
//--DEBUG-- cout << "String = "<<theStrings->at(i)->Get4Momentum()<<endl;
}
return theStrings;
}
G4V3DNucleus* G4QGSModel::GetWoundedNucleus() const
{
return theParticipants.GetWoundedNucleus();
}
//*********************************************************************************************************************
@@ -0,0 +1,205 @@
#include "globals.hh"
#include "G4QGSParticipants.hh"
#include "G4LorentzVector.hh"
// Class G4QGSParticipants
// HPW Feb 1999
// Promoting model parameters from local variables class properties
G4QGSParticipants::G4QGSParticipants() : nCutMax(7),ThersholdParameter(0.45*GeV),
QGSMThershold(3*GeV),theNucleonRadius(1.5*fermi),
theDiffExcitaton(0.7*GeV, 250*MeV, 250*MeV)
{
}
G4QGSParticipants::G4QGSParticipants(const G4QGSParticipants &right)
: nCutMax(right.nCutMax),ThersholdParameter(right.ThersholdParameter),
QGSMThershold(right.QGSMThershold),theNucleonRadius(right.theNucleonRadius)
{
}
G4QGSParticipants::~G4QGSParticipants()
{
}
void G4QGSParticipants::BuildInteractions(const G4ReactionProduct &thePrimary)
{
G4VSplitableHadron* aProjectile = new G4QGSMSplitableHadron(thePrimary, TRUE); // @@@ check the TRUE
G4PomeronCrossSection theProbability(thePrimary.GetDefinition()); // @@@ should be data member
G4double outerRadius = theNucleus->GetOuterRadius();
// Check reaction threshold
theNucleus->StartLoop();
G4Nucleon * pNucleon = theNucleus->GetNextNucleon();
G4LorentzVector aPrimaryMomentum(thePrimary.GetMomentum(), thePrimary.GetTotalEnergy());
G4double s = (aPrimaryMomentum + pNucleon->Get4Momentum()).mag2();
G4double ThresholdMass = thePrimary.GetMass() + pNucleon->GetDefinition()->GetPDGMass();
ModelMode = SOFT;
if (sqr(ThresholdMass + ThersholdParameter) > s)
{
G4Exception("Initial energy is too low. The 4-vectors of the input are inconsistant with the particle masses.");
}
if (sqr(ThresholdMass + QGSMThershold) > s) // thus only diffractive in cascade!
{
ModelMode = DIFFRACTIVE;
}
// first find the collisions HPW
theInteractions.clearAndDestroy();
G4int totalCuts = 0;
G4double impactUsed = 0;
while(theInteractions.entries() == 0)
{
// choose random impact parameter HPW
G4double x,y;
do
{
x = 2*G4UniformRand() - 1;
y = 2*G4UniformRand() - 1;
}
while(x*x + y*y > 1);
G4double impactX = x*(outerRadius+theNucleonRadius); // add nucleon radius, otherwise too small HPW
G4double impactY = y*(outerRadius+theNucleonRadius);
// loop over nuclei to find collissions HPW
theNucleus->StartLoop();
G4int nucleonCount = 0; // debug
while( pNucleon = theNucleus->GetNextNucleon() )
{
if(totalCuts>nCutMax) break;
nucleonCount++; // debug
// Needs to be moved to Probability class @@@
G4double s = (aPrimaryMomentum + pNucleon->Get4Momentum()).mag2();
G4double Distance2 = sqr(impactX - pNucleon->GetPosition().x()) +
sqr(impactY - pNucleon->GetPosition().y());
G4double Probability = theProbability.GetInelasticProbability(s, Distance2);
// test for inelastic collision
G4double rndNumber = G4UniformRand();
// ModelMode = DIFFRACTIVE;
if (Probability > rndNumber)
{
//--DEBUG-- cout << "DEBUG p="<< Probability<<" r="<<rndNumber<<" d="<<sqrt(Distance2)<<endl;
G4QGSMSplitableHadron* aTarget = new G4QGSMSplitableHadron(*pNucleon);
theTargets.insert(aTarget);
pNucleon->Hit(aTarget);
if ((theProbability.GetDiffractiveProbability(s, Distance2)/Probability > G4UniformRand()
&&(ModelMode==SOFT)) || (ModelMode==DIFFRACTIVE ))
{
// diffractive interaction occurs
if(IsSingleDiffractive())
{
theSingleDiffExcitation.ExciteParticipants(aProjectile, aTarget);
}
else
{
theDiffExcitaton.ExciteParticipants(aProjectile, aTarget);
}
G4InteractionContent * aInteraction = new G4InteractionContent(aProjectile);
aInteraction->SetTarget(aTarget);
theInteractions.insert(aInteraction);
totalCuts += 1;
}
else
{
// nondiffractive soft interaction occurs
// sample nCut+1 (cut Pomerons) pairs of strings can be produced
G4int nCut;
G4double * running = new G4double[nCutMax];
running[0] = 0;
for(nCut = 0; nCut < nCutMax; nCut++)
{
running[nCut] = theProbability.GetCutPomeronProbability(s, Distance2, nCut + 1);
if(nCut!=0) running[nCut] += running[nCut-1];
}
G4double random = running[nCutMax-1]*G4UniformRand();
for(nCut = 0; nCut < nCutMax; nCut++)
{
if(running[nCut] > random) break;
}
delete [] running;
nCut = 0;
aTarget->IncrementCollisionCount(nCut+1);
aProjectile->IncrementCollisionCount(nCut+1);
G4InteractionContent * aInteraction = new G4InteractionContent(aProjectile);
aInteraction->SetTarget(aTarget);
aInteraction->SetNumberOfSoftCollisions(nCut+1);
theInteractions.insert(aInteraction);
totalCuts += nCut+1;
impactUsed=Distance2;
}
}
}
//--DEBUG-- cout << endl<<"NUCLEONCOUNT "<<nucleonCount<<endl;
}
//--DEBUG-- cout << endl<<"CUTDEBUG "<< totalCuts <<endl;
//--DEBUG-- cout << "Impact Parameter used = "<<impactUsed<<endl;
// now build the parton pairs. HPW
SplitHadrons();
// soft collisions first HPW, ordering is vital
PerformSoftCollisions();
// the rest is diffractive HPW
PerformDiffractiveCollisions();
// clean-up, if necessary
theInteractions.clearAndDestroy();
theTargets.clearAndDestroy();
}
void G4QGSParticipants::PerformDiffractiveCollisions()
{
// remove the "G4PartonPair::PROJECTILE", etc., which are not necessary. @@@
G4int i;
for(i = 0; i < theInteractions.length(); i++)
{
G4InteractionContent* anIniteraction = theInteractions.at(i);
G4VSplitableHadron* aProjectile = anIniteraction->GetProjectile();
G4Parton* aParton = aProjectile->GetNextParton();
G4PartonPair * aPartonPair;
// projectile first HPW
if (aParton)
{
aPartonPair = new G4PartonPair(aParton, aProjectile->GetNextAntiParton(),
G4PartonPair::DIFFRACTIVE,
G4PartonPair::PROJECTILE);
thePartonPairs.insert(aPartonPair);
}
// then target HPW
G4VSplitableHadron* aTarget = anIniteraction->GetTarget();
aParton = aTarget->GetNextParton();
if (aParton)
{
aPartonPair = new G4PartonPair(aParton, aTarget->GetNextAntiParton(),
G4PartonPair::DIFFRACTIVE,
G4PartonPair::TARGET);
thePartonPairs.insert(aPartonPair);
}
}
}
void G4QGSParticipants::PerformSoftCollisions()
{
G4int i;
for(i = 0; i < theInteractions.length(); i++)
{
G4InteractionContent* anIniteraction = theInteractions.at(i);
G4PartonPair * aPair = NULL;
if (anIniteraction->GetNumberOfSoftCollisions())
{
G4VSplitableHadron* pProjectile = anIniteraction->GetProjectile();
G4VSplitableHadron* pTarget = anIniteraction->GetTarget();
for (G4int j = 0; j < anIniteraction->GetNumberOfSoftCollisions(); j++)
{
aPair = new G4PartonPair(pTarget->GetNextParton(), pProjectile->GetNextAntiParton(),
G4PartonPair::SOFT, G4PartonPair::TARGET);
thePartonPairs.insert(aPair);
aPair = new G4PartonPair(pProjectile->GetNextParton(), pTarget->GetNextAntiParton(),
G4PartonPair::SOFT, G4PartonPair::PROJECTILE);
thePartonPairs.insert(aPair);
}
delete theInteractions.removeAt(i--);
}
}
}
@@ -0,0 +1,196 @@
#include "G4SPBaryon.hh"
#include "Randomize.hh"
#include "G4ParticleTable.hh"
void G4SPBaryon::
SampleQuarkAndDiquark(G4int & quark, G4int & diQuark) const
{
G4double random = 0.999999*G4UniformRand();
G4double sum = 0;
for(G4int i=0; i<thePartonInfo.length(); i++)
{
sum += thePartonInfo[i]->GetProbability();
if (sum > random)
{
if (theDefinition->GetPDGEncoding() < 0)
{
quark = -thePartonInfo[i]->GetDiQuark();
diQuark = -thePartonInfo[i]->GetQuark();
}
else
{
quark = thePartonInfo[i]->GetQuark();
diQuark = thePartonInfo[i]->GetDiQuark();
}
break;
}
}
}
void G4SPBaryon::
FindDiquark(G4int quark, G4int & diQuark) const
{
G4double sum = 0;
G4int i;
for(i = 0; i<thePartonInfo.length(); i++)
{
if (abs(thePartonInfo[i]->GetQuark()) == abs(quark))
{
sum += thePartonInfo[i]->GetProbability();
}
}
G4double random = 0.999999*G4UniformRand();
G4double running = 0;
for(i = 0; thePartonInfo[i]->GetQuark() != 0 && i < 6; i++)
{
if (abs(thePartonInfo[i]->GetQuark()) == abs(quark))
{
running += thePartonInfo[i]->GetProbability();
if (running/sum >= random)
{
diQuark = thePartonInfo[i]->GetDiQuark();
break;
}
}
}
}
G4SPBaryon::
G4SPBaryon(G4Proton * aProton)
{
theDefinition = aProton;
thePartonInfo.insert(new G4SPPartonInfo(2203, 1, 1./3.));
thePartonInfo.insert(new G4SPPartonInfo(2103, 2, 1./6.));
thePartonInfo.insert(new G4SPPartonInfo(2101, 2, 1./2.));
}
G4SPBaryon::
G4SPBaryon(G4Neutron * aNeutron)
{
theDefinition = aNeutron;
thePartonInfo.insert(new G4SPPartonInfo(2103, 1, 1./6.));
thePartonInfo.insert(new G4SPPartonInfo(2101, 1, 1./2.));
thePartonInfo.insert(new G4SPPartonInfo(1103, 2, 1./3.));
}
G4SPBaryon::
G4SPBaryon(G4SigmaPlus * aSigmaPlus)
{
theDefinition = aSigmaPlus;
thePartonInfo.insert(new G4SPPartonInfo(2203, 3, 1./3.));
thePartonInfo.insert(new G4SPPartonInfo(3203, 2, 1./6.));
thePartonInfo.insert(new G4SPPartonInfo(3201, 2, 1./2.));
}
G4SPBaryon::
G4SPBaryon(G4SigmaZero * aSigmaZero)
{
theDefinition = aSigmaZero;
thePartonInfo.insert(new G4SPPartonInfo(2103, 3, 1./3.));
thePartonInfo.insert(new G4SPPartonInfo(3203, 1, 1./12.));
thePartonInfo.insert(new G4SPPartonInfo(3201, 1, 1./4.));
thePartonInfo.insert(new G4SPPartonInfo(3103, 2, 1./12.));
thePartonInfo.insert(new G4SPPartonInfo(3101, 2, 1./4.));
}
G4SPBaryon::
G4SPBaryon(G4SigmaMinus * aSigmaMinus)
{
theDefinition = aSigmaMinus;
thePartonInfo.insert(new G4SPPartonInfo(1103, 3, 1./3.));
thePartonInfo.insert(new G4SPPartonInfo(3103, 1, 1./6.));
thePartonInfo.insert(new G4SPPartonInfo(3101, 1, 1./2.));
}
G4SPBaryon::
G4SPBaryon(G4XiMinus * aXiMinus)
{
theDefinition = aXiMinus;
thePartonInfo.insert(new G4SPPartonInfo(3103, 3, 1./6.));
thePartonInfo.insert(new G4SPPartonInfo(3101, 3, 1./2.));
thePartonInfo.insert(new G4SPPartonInfo(3303, 1, 1./3.));
}
G4SPBaryon::
G4SPBaryon(G4XiZero * aXiZero)
{
theDefinition = aXiZero;
thePartonInfo.insert(new G4SPPartonInfo(3203, 3, 1./6.));
thePartonInfo.insert(new G4SPPartonInfo(3201, 3, 1./2.));
thePartonInfo.insert(new G4SPPartonInfo(3303, 2, 1./3.));
}
G4SPBaryon::
G4SPBaryon(G4Lambda * aLambda)
{
theDefinition = aLambda;
thePartonInfo.insert(new G4SPPartonInfo(2103, 3, 1./3.));
thePartonInfo.insert(new G4SPPartonInfo(3203, 1, 1./4.));
thePartonInfo.insert(new G4SPPartonInfo(3201, 1, 1./12.));
thePartonInfo.insert(new G4SPPartonInfo(3103, 2, 1./4.));
thePartonInfo.insert(new G4SPPartonInfo(3101, 2, 1./12.));
}
G4SPBaryon::
G4SPBaryon(G4OmegaMinus * anOmegaMinus)
{
theDefinition = anOmegaMinus;
thePartonInfo.insert(new G4SPPartonInfo(3303, 3, 1.));
}
// non static particles
G4SPBaryon::
G4SPBaryon(G4ParticleDefinition * aDefinition)
{
theDefinition = aDefinition;
if(theDefinition ==
G4ParticleTable::GetParticleTable()->FindParticle(2224))// D++
{
thePartonInfo.insert(new G4SPPartonInfo(2203, 2, 1.));
}
else if(theDefinition ==
G4ParticleTable::GetParticleTable()->FindParticle(2214))// D+
{
thePartonInfo.insert(new G4SPPartonInfo(2203, 1, 1./3.));
thePartonInfo.insert(new G4SPPartonInfo(2103, 2, 2./3.));
}
else if(theDefinition ==
G4ParticleTable::GetParticleTable()->FindParticle(2114))// D0
{
thePartonInfo.insert(new G4SPPartonInfo(2103, 1, 2./3.));
thePartonInfo.insert(new G4SPPartonInfo(2103, 2, 1./3.));
}
else if(theDefinition ==
G4ParticleTable::GetParticleTable()->FindParticle(1114))// D-
{
thePartonInfo.insert(new G4SPPartonInfo(1103, 1, 1.));
}
else if(theDefinition ==
G4ParticleTable::GetParticleTable()->FindParticle(3224))// S*+
{
thePartonInfo.insert(new G4SPPartonInfo(2203, 3, 1./3.));
thePartonInfo.insert(new G4SPPartonInfo(3203, 2, 2./3.));
}
else if(theDefinition ==
G4ParticleTable::GetParticleTable()->FindParticle(3214))// S*0
{
thePartonInfo.insert(new G4SPPartonInfo(2103, 3, 1./3.));
thePartonInfo.insert(new G4SPPartonInfo(3203, 1, 1./3.));
thePartonInfo.insert(new G4SPPartonInfo(3103, 2, 1./3.));
}
else if(theDefinition ==
G4ParticleTable::GetParticleTable()->FindParticle(3224))// S*-
{
thePartonInfo.insert(new G4SPPartonInfo(1103, 3, 1./3.));
thePartonInfo.insert(new G4SPPartonInfo(3103, 1, 2./3.));
}
else if(theDefinition ==
G4ParticleTable::GetParticleTable()->FindParticle(3324))// Xi*0
{
thePartonInfo.insert(new G4SPPartonInfo(3203, 3, 1./3.));
thePartonInfo.insert(new G4SPPartonInfo(3303, 2, 2./3.));
}
else if(theDefinition ==
G4ParticleTable::GetParticleTable()->FindParticle(3314))// Xi*-
{
thePartonInfo.insert(new G4SPPartonInfo(3103, 3, 2./3.));
thePartonInfo.insert(new G4SPPartonInfo(3303, 1, 1./3.));
}
}
@@ -0,0 +1,24 @@
#include "G4SoftStringBuilder.hh"
//***************************************************************************************************
G4SoftStringBuilder::G4SoftStringBuilder()
{
}
G4SoftStringBuilder::G4SoftStringBuilder(const G4SoftStringBuilder &right)
{
}
G4SoftStringBuilder::~G4SoftStringBuilder()
{
}
//***************************************************************************************************
G4ExcitedString* G4SoftStringBuilder::BuildString(G4PartonPair * aPair)
{
return new G4ExcitedString(aPair->GetParton1(), aPair->GetParton2(), aPair->GetDirection());
}
//***********************************************************************************************