Import Geant4 6.2.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 10:56:29 +02:00
parent 1d812b78b1
commit e083ffb441
1415 changed files with 111223 additions and 21207 deletions
@@ -271,45 +271,67 @@ void G4Fancy3DNucleus::ChooseNucleons()
void G4Fancy3DNucleus::ChoosePositions()
{
G4int i=0;
G4ThreeVector aPos,center;
G4ThreeVector aPos, delta;
std::vector<G4ThreeVector> places;
places.reserve(myA);
G4bool freeplace;
static G4double nd2 = sqr(nucleondistance);
G4double maxR=GetNuclearRadius(0.01); // there are no nucleons at a
// relative Density of 0.01
G4int jr=0;
G4int jx,jy;
G4double arand[600];
G4double *prand=arand;
// G4int Attempt=0;
while ( i < myA )
{
do
{ aPos=G4ThreeVector( (2*G4UniformRand()-1.),
(2*G4UniformRand()-1.),
(2*G4UniformRand()-1.));
{
// ++Attempt;
if ( jr < 3 )
{
jr=std::min(600,9*(myA - i));
HepRandom::getTheEngine()->flatArray(jr, prand );
}
jx=--jr;
jy=--jr;
aPos=G4ThreeVector( (2*arand[jx]-1.),
(2*arand[jy]-1.),
(2*arand[--jr]-1.));
} while (aPos.mag2() > 1. );
aPos *=maxR;
G4double density=theDensity->GetRelativeDensity(aPos);
if (G4UniformRand() < density)
{
freeplace= true;
G4double pFermi=theFermi.GetFermiMomentum(theDensity->GetDensity(aPos));
// protons must at least have binding energy of CoulombBarrier, so
// assuming the Fermi energy corresponds to a potential, we must place these such
// that the Fermi Energy > CoulombBarrier
if (theNucleons[i].GetDefinition() == G4Proton::Proton())
{
G4double eFermi= sqrt( sqr(pFermi) + sqr(theNucleons[i].GetDefinition()->GetPDGMass()) )
- theNucleons[i].GetDefinition()->GetPDGMass();
if (eFermi <= CoulombBarrier() ) freeplace=false;
}
for( int j=0; j<i && freeplace; j++)
{
freeplace= freeplace &&
(theNucleons[j].GetPosition()-aPos).mag() > nucleondistance;
delta = places[j] - aPos;
freeplace= delta.mag2() > nd2;
}
if ( freeplace )
{
G4double pFermi=theFermi.GetFermiMomentum(theDensity->GetDensity(aPos));
// protons must at least have binding energy of CoulombBarrier, so
// assuming the Fermi energy corresponds to a potential, we must place these such
// that the Fermi Energy > CoulombBarrier
if (theNucleons[i].GetDefinition() == G4Proton::Proton())
{
G4double eFermi= sqrt( sqr(pFermi) + sqr(theNucleons[i].GetDefinition()->GetPDGMass()) )
- theNucleons[i].GetDefinition()->GetPDGMass();
if (eFermi <= CoulombBarrier() ) freeplace=false;
}
}
if ( freeplace )
{
theNucleons[i].SetPosition(aPos);
places[i]=aPos;
++i;
}
}
}
// G4cout << "Att " << myA << " " << Attempt << G4endl;
}
@@ -43,7 +43,8 @@
G4GeneralPhaseSpaceDecay::G4GeneralPhaseSpaceDecay(G4int Verbose) :
G4VDecayChannel("Phase Space", Verbose)
G4VDecayChannel("Phase Space", Verbose),
theDaughterMasses(0)
{
if (GetVerboseLevel()>1) G4cout << "G4GeneralPhaseSpaceDecay:: constructor " << G4endl;
}
@@ -59,7 +60,8 @@ G4GeneralPhaseSpaceDecay::G4GeneralPhaseSpaceDecay(const G4String& theParentName
theNumberOfDaughters,
theDaughterName1,
theDaughterName2,
theDaughterName3)
theDaughterName3),
theDaughterMasses(0)
{
if (GetVerboseLevel()>1) G4cout << "G4GeneralPhaseSpaceDecay:: constructor " << G4endl;
@@ -83,7 +85,28 @@ G4GeneralPhaseSpaceDecay::G4GeneralPhaseSpaceDecay(const G4String& theParentName
theDaughterName1,
theDaughterName2,
theDaughterName3),
parentmass(theParentMass)
parentmass(theParentMass),
theDaughterMasses(0)
{
if (GetVerboseLevel()>1) G4cout << "G4GeneralPhaseSpaceDecay:: constructor " << G4endl;
}
G4GeneralPhaseSpaceDecay::G4GeneralPhaseSpaceDecay(const G4String& theParentName,
G4double theParentMass,
G4double theBR,
G4int theNumberOfDaughters,
const G4String& theDaughterName1,
const G4String& theDaughterName2,
const G4String& theDaughterName3,
const G4double *masses) :
G4VDecayChannel("Phase Space",
theParentName,theBR,
theNumberOfDaughters,
theDaughterName1,
theDaughterName2,
theDaughterName3),
parentmass(theParentMass),
theDaughterMasses(masses)
{
if (GetVerboseLevel()>1) G4cout << "G4GeneralPhaseSpaceDecay:: constructor " << G4endl;
}
@@ -162,15 +185,22 @@ G4DecayProducts *G4GeneralPhaseSpaceDecay::TwoBodyDecayIt()
//daughters'mass
G4double daughtermass[2];
G4double daughtermomentum;
daughtermass[0] = daughters[0]->GetPDGMass();
daughtermass[1] = daughters[1]->GetPDGMass();
if ( theDaughterMasses )
{
daughtermass[0]= *(theDaughterMasses);
daughtermass[1] = *(theDaughterMasses+1);
} else {
daughtermass[0] = daughters[0]->GetPDGMass();
daughtermass[1] = daughters[1]->GetPDGMass();
}
// G4double sumofdaughtermass = daughtermass[0] + daughtermass[1];
//create parent G4DynamicParticle at rest
G4ParticleMomentum dummy;
G4DynamicParticle * parentparticle = new G4DynamicParticle( parent, dummy, 0.0);
//create G4Decayproducts
//create G4Decayproducts @@GF why dummy parentparticle?
G4DecayProducts *products = new G4DecayProducts(*parentparticle);
delete parentparticle;
@@ -181,10 +211,12 @@ G4DecayProducts *G4GeneralPhaseSpaceDecay::TwoBodyDecayIt()
G4double phi = 2.0*M_PI*G4UniformRand()*rad;
G4ParticleMomentum direction(sintheta*cos(phi),sintheta*sin(phi),costheta);
//create daughter G4DynamicParticle
G4DynamicParticle * daughterparticle = new G4DynamicParticle( daughters[0], direction*daughtermomentum);
//create daughter G4DynamicParticle
G4double Etotal= sqrt(daughtermass[0]*daughtermass[0] + daughtermomentum*daughtermomentum);
G4DynamicParticle * daughterparticle = new G4DynamicParticle( daughters[0],Etotal, direction*daughtermomentum);
products->PushProducts(daughterparticle);
daughterparticle = new G4DynamicParticle( daughters[1], direction*(-1.0*daughtermomentum));
Etotal= sqrt(daughtermass[1]*daughtermass[1] + daughtermomentum*daughtermomentum);
daughterparticle = new G4DynamicParticle( daughters[1],Etotal, direction*(-1.0*daughtermomentum));
products->PushProducts(daughterparticle);
if (GetVerboseLevel()>1)
@@ -206,7 +238,12 @@ G4DecayProducts *G4GeneralPhaseSpaceDecay::ThreeBodyDecayIt()
G4double sumofdaughtermass = 0.0;
for (G4int index=0; index<3; index++)
{
daughtermass[index] = daughters[index]->GetPDGMass();
if ( theDaughterMasses )
{
daughtermass[index]= *(theDaughterMasses+index);
} else {
daughtermass[index] = daughters[index]->GetPDGMass();
}
sumofdaughtermass += daughtermass[index];
}
@@ -274,8 +311,9 @@ G4DecayProducts *G4GeneralPhaseSpaceDecay::ThreeBodyDecayIt()
sinphi = sin(phi);
cosphi = cos(phi);
G4ParticleMomentum direction0(sintheta*cosphi,sintheta*sinphi,costheta);
G4double Etotal=sqrt( daughtermass[0]*daughtermass[0] + daughtermomentum[0]*daughtermomentum[0]);
G4DynamicParticle * daughterparticle
= new G4DynamicParticle( daughters[0], direction0*daughtermomentum[0]);
= new G4DynamicParticle( daughters[0], Etotal, direction0*daughtermomentum[0]);
products->PushProducts(daughterparticle);
costhetan = (daughtermomentum[1]*daughtermomentum[1]-daughtermomentum[2]*daughtermomentum[2]-daughtermomentum[0]*daughtermomentum[0])/(2.0*daughtermomentum[2]*daughtermomentum[0]);
@@ -287,14 +325,13 @@ G4DecayProducts *G4GeneralPhaseSpaceDecay::ThreeBodyDecayIt()
direction2.setX( sinthetan*cosphin*costheta*cosphi - sinthetan*sinphin*sinphi + costhetan*sintheta*cosphi);
direction2.setY( sinthetan*cosphin*costheta*sinphi + sinthetan*sinphin*cosphi + costhetan*sintheta*sinphi);
direction2.setZ( -sinthetan*cosphin*sintheta + costhetan*costheta);
daughterparticle = new G4DynamicParticle( daughters[2], direction2*(daughtermomentum[2]/direction2.mag()));
Etotal=sqrt( daughtermass[2]*daughtermass[2] + daughtermomentum[2]*daughtermomentum[2]/direction2.mag2());
daughterparticle = new G4DynamicParticle( daughters[2],Etotal, direction2*(daughtermomentum[2]/direction2.mag()));
products->PushProducts(daughterparticle);
G4ThreeVector mom=(direction0*daughtermomentum[0] + direction2*(daughtermomentum[2]/direction2.mag()))*(-1.0);
Etotal= sqrt( daughtermass[1]*daughtermass[1] + mom.mag2() );
daughterparticle =
new G4DynamicParticle(
daughters[1],
(direction0*daughtermomentum[0] + direction2*(daughtermomentum[2]/direction2.mag()))*(-1.0)
);
new G4DynamicParticle(daughters[1], Etotal, mom);
products->PushProducts(daughterparticle);
if (GetVerboseLevel()>1) {
@@ -491,6 +491,7 @@ G4KineticTrackVector* G4KineticTrack::Decay()
G4int chargeBalance = G4lrint(theDefinition->GetPDGCharge() );
G4int baryonBalance = G4lrint(theDefinition->GetBaryonNumber() );
G4LorentzVector energyMomentumBalance(Get4Momentum());
G4double theTotalActualWidth = this->EvaluateTotalActualWidth();
if (theTotalActualWidth !=0)
{
@@ -545,11 +546,28 @@ G4KineticTrackVector* G4KineticTrack::Decay()
G4double theParentMass = this->GetActualMass();
G4double theBR = theActualWidth[index];
// cout << "**BR*** DECAYNEW " << theBR << G4endl;
// cout << "**PMass*** DECAYNEW " << theParentMass << G4endl;
G4int theNumberOfDaughters = theDecayChannel->GetNumberOfDaughters();
G4String theDaughtersName1 = "";
G4String theDaughtersName2 = "";
G4String theDaughtersName3 = "";
G4String theDaughtersName3 = "";
G4double masses[3]={0.,0.,0.};
G4int shortlivedDaughters[3];
G4int numberOfShortliveds(0);
G4double SumLongLivedMass(0);
for (G4int aD=0; aD < theNumberOfDaughters ; aD++)
{
G4ParticleDefinition* aDaughter = theDecayChannel->GetDaughter(aD);
masses[aD] = aDaughter->GetPDGMass();
if ( aDaughter->IsShortLived() )
{
shortlivedDaughters[numberOfShortliveds]=aD;
numberOfShortliveds++;
} else {
SumLongLivedMass += aDaughter->GetPDGMass();
}
}
switch (theNumberOfDaughters)
{
case 0:
@@ -560,14 +578,37 @@ G4KineticTrackVector* G4KineticTrack::Decay()
theDaughtersName3 = "";
break;
case 2:
theDaughtersName1 = theDecayChannel->GetDaughterName(0);
theDaughtersName1 = theDecayChannel->GetDaughterName(0);
theDaughtersName2 = theDecayChannel->GetDaughterName(1);
theDaughtersName3 = "";
if ( numberOfShortliveds == 1)
{ G4SampleResonance aSampler;
G4double massmax=theParentMass - SumLongLivedMass;
G4ParticleDefinition * aDaughter=theDecayChannel->GetDaughter(shortlivedDaughters[0]);
masses[shortlivedDaughters[0]]= aSampler.SampleMass(aDaughter,massmax);
} else if ( numberOfShortliveds == 2) {
// choose masses one after the other, start with randomly choosen
G4int zero= (G4UniformRand() > 0.5) ? 0 : 1;
G4int one = 1-zero;
G4SampleResonance aSampler;
G4double massmax=theParentMass - aSampler.GetMinimumMass(theDecayChannel->GetDaughter(shortlivedDaughters[one]));
G4ParticleDefinition * aDaughter=theDecayChannel->GetDaughter(shortlivedDaughters[zero]);
masses[shortlivedDaughters[zero]]=aSampler.SampleMass(aDaughter,massmax);
massmax=theParentMass - masses[shortlivedDaughters[zero]];
aDaughter=theDecayChannel->GetDaughter(shortlivedDaughters[one]);
masses[shortlivedDaughters[one]]=aSampler.SampleMass(aDaughter,massmax);
}
break;
default:
theDaughtersName1 = theDecayChannel->GetDaughterName(0);
theDaughtersName2 = theDecayChannel->GetDaughterName(1);
theDaughtersName3 = theDecayChannel->GetDaughterName(2);
if ( numberOfShortliveds == 1)
{ G4SampleResonance aSampler;
G4double massmax=theParentMass - SumLongLivedMass;
G4ParticleDefinition * aDaughter=theDecayChannel->GetDaughter(shortlivedDaughters[0]);
masses[shortlivedDaughters[0]]= aSampler.SampleMass(aDaughter,massmax);
}
break;
}
@@ -581,7 +622,8 @@ G4KineticTrackVector* G4KineticTrack::Decay()
theNumberOfDaughters,
theDaughtersName1,
theDaughtersName2,
theDaughtersName3);
theDaughtersName3,
masses);
G4DecayProducts* theDecayProducts = thePhaseSpaceDecayChannel.DecayIt();
if(!theDecayProducts)
{
@@ -602,6 +644,7 @@ G4KineticTrackVector* G4KineticTrack::Decay()
G4double theFormationTime = 0.0;
G4ThreeVector thePosition = this->GetPosition();
G4LorentzVector momentum;
G4LorentzVector momentumBalanceCMS(0);
G4KineticTrackVector* theDecayProductList = new G4KineticTrackVector;
G4int dEntries = theDecayProducts->entries();
G4ParticleDefinition * aProduct = 0;
@@ -611,7 +654,9 @@ G4KineticTrackVector* G4KineticTrack::Decay()
aProduct = theDynamicParticle->GetDefinition();
chargeBalance -= G4lrint(aProduct->GetPDGCharge() );
baryonBalance -= G4lrint(aProduct->GetBaryonNumber() );
momentumBalanceCMS += theDynamicParticle->Get4Momentum();
momentum = toMoving*theDynamicParticle->Get4Momentum();
energyMomentumBalance -= momentum;
theDecayProductList->push_back(new G4KineticTrack (aProduct,
theFormationTime,
thePosition,
@@ -621,7 +666,9 @@ G4KineticTrackVector* G4KineticTrack::Decay()
delete theDecayProducts;
delete [] theCumActualWidth;
if(getenv("DecayEnergyBalanceCheck"))
std::cout << "DEBUGGING energy balance D: "
std::cout << "DEBUGGING energy balance in cms and lab, charge baryon balance : "
<< momentumBalanceCMS << " "
<<energyMomentumBalance << " "
<<chargeBalance<<" "
<<baryonBalance<<" "
<<G4endl;
@@ -0,0 +1,101 @@
//
// ********************************************************************
// * 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. *
// * *
// * Parts of this code which have been developed by QinetiQ Ltd *
// * under contract to the European Space Agency (ESA) are the *
// * intellectual property of ESA. Rights to use, copy, modify and *
// * redistribute this software for general public use are granted *
// * in compliance with any licensing, distribution and development *
// * policy adopted by the Geant4 Collaboration. This code has been *
// * written by QinetiQ Ltd for the European Space Agency, under ESA *
// * contract 17191/03/NL/LvH (Aurora Programme). *
// * *
// * 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. *
// ********************************************************************
//
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//
// MODULE: G4WilsonRadius.cc
//
// Version: B.1
// Date: 15/04/04
// Author: P R Truscott
// Organisation: QinetiQ Ltd, UK
// Customer: ESA/ESTEC, NOORDWIJK
// Contract: 17191/03/NL/LvH
//
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//
// CHANGE HISTORY
// --------------
//
// 6 October 2003, P R Truscott, QinetiQ Ltd, UK
// Created.
//
// 15 March 2004, P R Truscott, QinetiQ Ltd, UK
// Beta release
//
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//
////////////////////////////////////////////////////////////////////////////////
//
#include "G4WilsonRadius.hh"
////////////////////////////////////////////////////////////////////////////////
//
G4WilsonRadius::G4WilsonRadius ()
{
G4double r0 = 0.84*fermi;
r0sq = r0 * r0;
factor = sqrt(5.0/3.0) * fermi;
third = 1.0 / 3.0;
}
////////////////////////////////////////////////////////////////////////////////
//
G4WilsonRadius::~G4WilsonRadius ()
{;}
////////////////////////////////////////////////////////////////////////////////
//
G4double G4WilsonRadius::GetWilsonRMSRadius (G4double A)
{
G4double radius;
if (A > 26.0)
radius = factor * (0.84*pow(A,third) + 0.55);
else
{
G4double r[27] = {0.0, 0.85, 2.095, 1.976, 1.671, 1.986,
2.57, 2.41, 2.23, 2.519, 2.45,
2.42, 2.471, 2.440, 2.58, 2.611,
2.730, 2.662, 2.727, 2.9, 3.040,
2.867, 2.969, 2.94, 3.075, 3.11,
3.06};
radius = factor * r[(G4int) (A+0.4)];
}
return radius;
}
////////////////////////////////////////////////////////////////////////////////
//
G4double G4WilsonRadius::GetWilsonRadius (G4double A)
{
G4double r = GetWilsonRMSRadius(A);
return 1.29*sqrt(r*r-r0sq);
}
////////////////////////////////////////////////////////////////////////////////
//