Import Geant4 6.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 10:41:53 +02:00
parent 4aea781e80
commit 96686e0c8f
6560 changed files with 153347 additions and 238155 deletions
@@ -0,0 +1,67 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * 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. *
// ********************************************************************
//
#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 (unsigned int aFragment=0; aFragment < fragments->size(); aFragment++)
{
result->push_back(fragments->operator[](aFragment));
}
string = theExcitation->String(& bHadron, false); // Target
fragments=theStringFragmentation->FragmentString(*string);
for (unsigned int bFragment=0; bFragment < fragments->size(); bFragment++)
{
result->push_back(fragments->operator[](bFragment));
}
return result;
}
@@ -0,0 +1,203 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * 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: G4DiffractiveSplitableHadron.cc,v 1.3 2003/11/03 17:54:53 hpw Exp $
// GEANT4 tag $Name: geant4-06-00 $
//
// ------------------------------------------------------------
// GEANT 4 class implementation file
//
// ---------------- 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 &)
{
throw G4HadronicException(__FILE__, __LINE__, "G4DiffractiveSplitableHadron::operator= meant to not be accessable");
return *this;
}
void G4DiffractiveSplitableHadron::SplitUp()
{
if (IsSplit()) return;
Splitting();
// 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 , std::max( heavy, light));
G4int anti= 1 -2 * ( std::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;
// Careful, there is no diquark q1=q2, (q1 q2)0,
// possible for Omega-
*bEnd= Diquark( j1000, j10, j1000 != j100 ? 0 : 1);
}
} else
{
// Lambda-like hadrons have two lightest quarks in spin 0
if ( random < udspin1 )
{
*aEnd=j1000;
// as above, but with charmed barions
*bEnd= Diquark( j100, j10, j100 != j10 ? 0 : 10);
} 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 = std::max( abs(aquark), abs(bquark) )*1000 +
std::min( abs(aquark), abs(bquark) )*100 +
2*Spin + 1;
return ( aquark > 0 && bquark > 0 ) ? diquarkPDG : -1*diquarkPDG;
}
@@ -0,0 +1,174 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * 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: G4FTFModel.cc,v 1.3 2003/11/03 17:54:53 hpw Exp $
// GEANT4 tag $Name: geant4-06-00 $
//
// ------------------------------------------------------------
// GEANT 4 class implementation file
//
// ---------------- 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(G4DiffractiveExcitation * anExcitation)
:
theExcitation(anExcitation)
{
G4VPartonStringModel::SetThisPointer(this);
}
G4FTFModel::~G4FTFModel()
{}
const G4FTFModel & G4FTFModel::operator=(const G4FTFModel &)
{
throw G4HadronicException(__FILE__, __LINE__, "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;
}
struct DeleteVSplitableHadron { void operator()(G4VSplitableHadron * aH){delete aH;} };
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();
std::vector<G4VSplitableHadron *> primaries;
std::vector<G4VSplitableHadron *> targets;
theParticipants.StartLoop(); // restart a loop
while ( theParticipants.Next() )
{
const G4InteractionContent & interaction=theParticipants.GetInteraction();
// do not allow for duplicates ...
if ( primaries.end() == std::find(primaries.begin(), primaries.end(), interaction.GetProjectile()) )
primaries.push_back(interaction.GetProjectile());
if ( targets.end() == std::find(targets.begin(), targets.end(),interaction.GetTarget()) )
targets.push_back(interaction.GetTarget());
}
// G4cout << "BuildStrings prim/targ " << primaries.entries() << " , " <<
// targets.entries() << G4endl;
unsigned int ahadron;
for ( ahadron=0; ahadron < primaries.size() ; ahadron++)
{
G4bool isProjectile=true;
strings->push_back(theExcitation->String(primaries[ahadron], isProjectile));
}
for ( ahadron=0; ahadron < targets.size() ; ahadron++)
{
G4bool isProjectile=false;
strings->push_back(theExcitation->String(targets[ahadron], isProjectile));
}
std::for_each(primaries.begin(), primaries.end(), DeleteVSplitableHadron());
primaries.clear();
std::for_each(targets.begin(), targets.end(), DeleteVSplitableHadron());
targets.clear();
return strings;
}
G4bool G4FTFModel::ExciteParticipants()
{
// G4cout << "G4FTFModel::ExciteParticipants starting " << G4endl;
while (theParticipants.Next())
{
// G4cout << "next Collision " << G4endl;
const G4InteractionContent & collision=theParticipants.GetInteraction();
// G4cout << " soft colls : " << collision.GetNumberOfSoftCollisions() << G4endl;
G4VSplitableHadron * projectile=collision.GetProjectile();
G4VSplitableHadron * target=collision.GetTarget();
if ( ! theExcitation->ExciteParticipants(projectile, target) )
{
return false;
}
}
return true;
}
@@ -0,0 +1,156 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * 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: G4FTFParticipants.cc,v 1.2 2003/10/08 13:48:47 hpw Exp $
// GEANT4 tag $Name: geant4-06-00 $
//
// ------------------------------------------------------------
// GEANT 4 class implementation file
//
// ---------------- 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"
#include "G4Pair.hh"
// Class G4FTFParticipants
G4FTFParticipants::G4FTFParticipants()
{
}
G4FTFParticipants::G4FTFParticipants(const G4FTFParticipants &): G4VParticipants()
{
}
G4FTFParticipants::~G4FTFParticipants()
{
// G4cout << "G4FTFParticipants::~G4FTFParticipants() called" << G4endl;
}
//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
for(unsigned int i=0; i<theInteractions.size(); i++) delete theInteractions[i];
theInteractions.clear();
// --- 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 << G4endl;
// G4cout << " primary Mass (GeV): " << thePrimary.GetMass() /GeV << G4endl;
// G4cout << "cms sqrt(s) (GeV) = " << sqrt(s) / GeV << G4endl;
G4PomeronCrossSection theCrossSection(thePrimary.GetDefinition());
G4double deltaxy=2 * fermi;
G4VSplitableHadron * primarySplitable=new G4DiffractiveSplitableHadron(thePrimary);
G4double xyradius;
xyradius =theNucleus->GetOuterRadius() + deltaxy;
// G4cout <<" G4FTFParticipants::StartLoop: xyradius " << xyradius << G4endl;
G4bool nucleusNeedsShift = true;
while ( theInteractions.size() == 0 )
{
G4Pair<G4double, G4double> theImpactParameter;
theImpactParameter = theNucleus->ChooseImpactXandY(xyradius);
G4double impactX = theImpactParameter.first;
G4double impactY = theImpactParameter.second;
// G4cout << " impctX, impctY " << impactX/fermi << " "<<impactY/fermi << " fm" << G4endl;
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.push_back(aInteraction);
}
}
// G4cout << "Number of Hit nucleons " << theInteractions.entries()
// << "\t" << impactX/fermi << "\t"<<impactY/fermi
// << "\t" << sqrt(sqr(impactX)+sqr(impactY))/fermi <<G4endl;
}
}
// Implementation (private) methods