Import Geant4 3.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 15:55:53 +02:00
parent e7d7193284
commit cfcb558cfe
3050 changed files with 91703 additions and 48310 deletions
@@ -0,0 +1,128 @@
// 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: G4EnergyLossMessenger.cc,v 1.3 2000/11/09 15:52:24 maire Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "G4EnergyLossMessenger.hh"
#include "G4VEnergyLoss.hh"
#include "G4UIdirectory.hh"
#include "G4UIcommand.hh"
#include "G4UIparameter.hh"
#include "G4UIcmdWithABool.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "g4std/strstream"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4EnergyLossMessenger::G4EnergyLossMessenger()
{
eLossDirectory = new G4UIdirectory("/process/eLoss/");
eLossDirectory->SetGuidance("Commands for G4VEnergyLoss.");
RndmStepCmd = new G4UIcmdWithABool("/process/eLoss/rndmStep",this);
RndmStepCmd->SetGuidance("Randomize the proposed step by eLoss.");
RndmStepCmd->SetParameterName("choice",true);
RndmStepCmd->SetDefaultValue(false);
RndmStepCmd->AvailableForStates(Idle);
EnlossFlucCmd = new G4UIcmdWithABool("/process/eLoss/fluct",this);
EnlossFlucCmd->SetGuidance("Switch true/false the energy loss fluctuations.");
EnlossFlucCmd->SetParameterName("choice",true);
EnlossFlucCmd->SetDefaultValue(true);
EnlossFlucCmd->AvailableForStates(Idle);
SubSecCmd = new G4UIcmdWithABool("/process/eLoss/subsec",this);
SubSecCmd->SetGuidance("Switch true/false the subcutoff generation.");
SubSecCmd->SetParameterName("choice",true);
SubSecCmd->SetDefaultValue(true);
SubSecCmd->AvailableForStates(Idle);
MinSubSecCmd = new G4UIcmdWithADoubleAndUnit("/process/eLoss/minsubsec",this);
MinSubSecCmd->SetGuidance("Set the min. cut for subcutoff delta in range.");
MinSubSecCmd->SetParameterName("rcmin",true);
MinSubSecCmd->AvailableForStates(Idle);
StepFuncCmd = new G4UIcommand("/process/eLoss/StepFunction",this);
StepFuncCmd->SetGuidance("Set the energy loss step limitation parameters.");
StepFuncCmd->SetGuidance(" dRoverR : max Range variation per step");
StepFuncCmd->SetGuidance(" finalRange: range for final step");
G4UIparameter* dRoverRPrm = new G4UIparameter("dRoverR",'d',false);
dRoverRPrm->SetGuidance("max Range variation per step (fractional number)");
dRoverRPrm->SetParameterRange("dRoverR>0. && dRoverR<=1.");
StepFuncCmd->SetParameter(dRoverRPrm);
G4UIparameter* finalRangePrm = new G4UIparameter("finalRange",'d',false);
finalRangePrm->SetGuidance("range for final step");
finalRangePrm->SetParameterRange("finalRange>0.");
StepFuncCmd->SetParameter(finalRangePrm);
G4UIparameter* unitPrm = new G4UIparameter("unit",'s',true);
unitPrm->SetGuidance("unit of finalRange");
unitPrm->SetDefaultValue("mm");
G4String unitCandidates = G4UIcommand::UnitsList(G4UIcommand::CategoryOf("mm"));
unitPrm->SetParameterCandidates(unitCandidates);
StepFuncCmd->SetParameter(unitPrm);
StepFuncCmd->AvailableForStates(Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4EnergyLossMessenger::~G4EnergyLossMessenger()
{
delete RndmStepCmd;
delete EnlossFlucCmd;
delete SubSecCmd;
delete MinSubSecCmd;
delete StepFuncCmd;
delete eLossDirectory;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EnergyLossMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
{
if (command == RndmStepCmd)
{ G4VEnergyLoss::SetRndmStep(RndmStepCmd->GetNewBoolValue(newValue));
}
if (command == EnlossFlucCmd)
{ G4VEnergyLoss::SetEnlossFluc(EnlossFlucCmd->GetNewBoolValue(newValue));
}
if (command == SubSecCmd)
{ G4VEnergyLoss::SetSubSec(SubSecCmd->GetNewBoolValue(newValue));
}
if (command == MinSubSecCmd)
{ G4VEnergyLoss::SetMinDeltaCutInRange(MinSubSecCmd->GetNewDoubleValue(newValue));
}
if (command == StepFuncCmd)
{
G4double v1,v2;
char unts[30];
const char* t = newValue;
G4std::istrstream is((char*)t);
is >> v1 >> v2 >> unts;
G4String unt = unts;
v2 *= G4UIcommand::ValueOf(unt);
G4VEnergyLoss::SetStepFunction(v1,v2);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4EnergyLossTables.cc,v 1.12 2000/05/23 14:25:26 urban Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4EnergyLossTables.cc,v 1.13 2000/11/04 16:47:29 maire Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
// -------------------------------------------------------------------
// first version created by P.Urban , 06/04/1998
@@ -61,7 +61,7 @@ void G4EnergyLossTables::Register(
G4double G4EnergyLossTables::GetPreciseDEDX(
const G4ParticleDefinition *aParticle,
G4double KineticEnergy,
G4Material *aMaterial)
const G4Material *aMaterial)
{
if( aParticle != lastParticle)
{
@@ -104,7 +104,7 @@ void G4EnergyLossTables::Register(
G4double G4EnergyLossTables::GetPreciseRangeFromEnergy(
const G4ParticleDefinition *aParticle,
G4double KineticEnergy,
G4Material *aMaterial)
const G4Material *aMaterial)
{
if( aParticle != lastParticle)
{
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4IMultipleScattering.cc,v 1.1 2000/03/20 14:44:04 maire Exp $
// GEANT4 tag $Name: geant4-02-00 $
// GEANT4 tag $Name: geant4-03-00 $
//
// $Id:
// --------------------------------------------------------------
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4MultipleScattering.cc,v 1.3 2000/03/24 08:12:26 urban Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4MultipleScattering.cc,v 1.5 2000/08/10 13:15:13 urban Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
// $Id:
// --------------------------------------------------------------
@@ -25,6 +25,8 @@
// 17/09/99: corr. for high energy and/or small step , L.Urban
// 30/09/99: nuclear size effect correction, L.Urban
// 22/03/00: value of member cpar has changed! , L.Urban
// 20/06/00: nuclear size correction for particles other than e+/e- only , L.Urban
// 10/08/00 values of some data members has been changed, L.Urban
// --------------------------------------------------------------
#include "G4MultipleScattering.hh"
@@ -49,10 +51,10 @@
thePositron(G4Positron::Positron()),
tLast (0.0),
zLast (0.0),
Tlimit(0.*keV),
Tlimit(1.*keV),
scatteringparameter(0.9),
tuning (1.00),
cpar (-0.35),
cpar (0.0),
NuclCorrPar (0.0615),FactPar(0.40),
fLatDisplFlag(true)
{ }
@@ -73,12 +75,6 @@
// tables are built for MATERIALS
{
// parameter for "low energy" msc (not for ions)
if((&aParticleType == G4Electron::Electron()) ||
(&aParticleType == G4Positron::Positron()) )
// Tlimit = 100.*keV ;
;
const G4double sigmafactor = twopi*classic_electr_radius*
classic_electr_radius ;
G4double KineticEnergy,AtomicNumber,AtomicWeight,
@@ -218,8 +214,8 @@
{65.87,59.06,15.87,7.570,5.567,3.650,2.682,2.182,
1.939,1.579,1.325,1.178,1.108,1.014,0.965,0.947,
0.941,0.938,0.940,0.944,0.946,0.954 },
// {45.60,47.34,15.92,7.810,5.755,3.767,2.760,2.239, misprint?
{55.60,47.34,15.92,7.810,5.755,3.767,2.760,2.239,
// {45.60,47.34,15.92,7.810,5.755,3.767,2.760,2.239, // paper.....
{55.60,47.34,15.92,7.810,5.755,3.767,2.760,2.239,
1.985,1.609,1.343,1.188,1.113,1.013,0.960,0.939,
0.933,0.930,0.933,0.936,0.939,0.949 }};
@@ -406,7 +402,10 @@
sigma *= corrfactor ;
sigma /= corrnuclsize ;
// nucl. size correction for particles other than e+/e- only at present !!!!
if((&aParticleType != G4Electron::Electron()) &&
(&aParticleType != G4Positron::Positron()) )
sigma /= corrnuclsize ;
return sigma ;
}
@@ -1,43 +1,47 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
// 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: G4VEnergyLoss.cc,v 1.11 2000/05/26 07:40:09 urban Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4VEnergyLoss.cc,v 1.15 2000/10/30 06:50:49 urban Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// --------------------------------------------------------------
// GEANT 4 class implementation file
//
// For information related to this code contact:
// CERN, CN Division, ASD Group
// History: first implementation, based on object model of
// 2nd December 1995, G.Cosmo
// --------------------------------------------------------------
// bug fixed in fluct., L.Urban 26/05/00
// ------------------------------------------------------------
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "G4VEnergyLoss.hh"
#include "G4EnergyLossMessenger.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4VEnergyLoss::ParticleMass ;
G4double G4VEnergyLoss::taulow ;
G4double G4VEnergyLoss::tauhigh ;
G4double G4VEnergyLoss::ltaulow ;
G4double G4VEnergyLoss::ltauhigh ;
G4double G4VEnergyLoss::ltaulow ;
G4double G4VEnergyLoss::ltauhigh ;
G4bool G4VEnergyLoss::rndmStepFlag = false;
G4bool G4VEnergyLoss::EnlossFlucFlag = true;
G4bool G4VEnergyLoss::subSecFlag = true;
G4double G4VEnergyLoss::MinDeltaCutInRange = 0.100*mm ;
G4double* G4VEnergyLoss::MinDeltaEnergy = NULL ;
G4bool* G4VEnergyLoss::LowerLimitForced = NULL ;
G4bool G4VEnergyLoss::setMinDeltaCutInRange = false ;
G4double G4VEnergyLoss::dRoverRange = 20*perCent;
G4double G4VEnergyLoss::finalRange = 200*micrometer;
G4double G4VEnergyLoss::c1lim = dRoverRange ;
G4double G4VEnergyLoss::c2lim = 2.*(1.-dRoverRange)*finalRange ;
G4double G4VEnergyLoss::c3lim = -(1.-dRoverRange)*finalRange*finalRange;
G4EnergyLossMessenger* G4VEnergyLoss::ELossMessenger = NULL;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -58,13 +62,14 @@ G4VEnergyLoss::G4VEnergyLoss(const G4String& aName , G4ProcessType aType)
nmaxCont1(4),
nmaxCont2(16)
{
//create (only once) EnergyLoss messenger
if(!ELossMessenger) ELossMessenger = new G4EnergyLossMessenger();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4VEnergyLoss::~G4VEnergyLoss()
{
}
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -73,8 +78,7 @@ G4VEnergyLoss::G4VEnergyLoss(G4VEnergyLoss& right)
lastMaterial(NULL),
nmaxCont1(4),
nmaxCont2(16)
{
}
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -316,7 +320,6 @@ G4double G4VEnergyLoss::RangeIntLog(G4PhysicsVector* physicsVector,
return Value;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4PhysicsTable* G4VEnergyLoss::BuildLabTimeTable(G4PhysicsTable* theDEDXTable,
@@ -867,7 +870,9 @@ G4PhysicsTable* G4VEnergyLoss::BuildRangeCoeffCTable(G4PhysicsTable* theRangeTab
G4double G4VEnergyLoss::GetLossWithFluct(const G4DynamicParticle* aParticle,
G4Material* aMaterial,
G4double MeanLoss)
G4double ChargeSquare,
G4double MeanLoss,
G4double step )
// calculate actual loss from the mean loss
// The model used to get the fluctuation is essentially the same as in Glandz in Geant3.
{
@@ -876,6 +881,7 @@ G4double G4VEnergyLoss::GetLossWithFluct(const G4DynamicParticle* aParticle,
static const G4double sumaLim = -log(probLim) ;
static const G4double alim=10.;
static const G4double kappa = 10. ;
static const G4double factor = twopi_mc2_rcl2 ;
// check if the material has changed ( cache mechanism)
@@ -895,7 +901,7 @@ G4double G4VEnergyLoss::GetLossWithFluct(const G4DynamicParticle* aParticle,
ipotLogFluct = aMaterial->GetIonisation()->GetLogMeanExcEnergy();
}
G4double threshold,w1,w2,C,
beta2,suma,e0,loss,lossc ,w;
beta2,suma,e0,loss,lossc ,w,electronDensity;
G4double a1,a2,a3;
G4int p1,p2,p3;
G4int nb;
@@ -923,8 +929,10 @@ G4double G4VEnergyLoss::GetLossWithFluct(const G4DynamicParticle* aParticle,
// Gaussian fluctuation ?
if(MeanLoss >= kappa*Tm)
{
siga = sqrt(MeanLoss*Tm*(1.-0.5*beta2)) ;
loss = RandGauss::shoot(MeanLoss,siga) ;
electronDensity = aMaterial->GetElectronDensity() ;
siga = sqrt(Tm*(0.5-0.25*beta2)*step*
factor*electronDensity*ChargeSquare/beta2) ;
loss = G4RandGauss::shoot(MeanLoss,siga) ;
if(loss < 0.) loss = 0. ;
return loss ;
}
@@ -960,7 +968,7 @@ G4double G4VEnergyLoss::GetLossWithFluct(const G4DynamicParticle* aParticle,
if(a3>alim)
{
siga=sqrt(a3) ;
p3 = G4std::max(0,int(RandGauss::shoot(a3,siga)+0.5));
p3 = G4std::max(0,int(G4RandGauss::shoot(a3,siga)+0.5));
}
else
p3 = G4Poisson(a3);
@@ -979,7 +987,7 @@ G4double G4VEnergyLoss::GetLossWithFluct(const G4DynamicParticle* aParticle,
if(a3>alim)
{
siga=sqrt(a3) ;
p3 = G4std::max(0,int(RandGauss::shoot(a3,siga)+0.5));
p3 = G4std::max(0,int(G4RandGauss::shoot(a3,siga)+0.5));
}
else
p3 = G4Poisson(a3);
@@ -1008,7 +1016,7 @@ G4double G4VEnergyLoss::GetLossWithFluct(const G4DynamicParticle* aParticle,
if(a1>alim)
{
siga=sqrt(a1) ;
p1 = G4std::max(0,int(RandGauss::shoot(a1,siga)+0.5));
p1 = G4std::max(0,int(G4RandGauss::shoot(a1,siga)+0.5));
}
else
p1 = G4Poisson(a1);
@@ -1017,7 +1025,7 @@ G4double G4VEnergyLoss::GetLossWithFluct(const G4DynamicParticle* aParticle,
if(a2>alim)
{
siga=sqrt(a2) ;
p2 = G4std::max(0,int(RandGauss::shoot(a2,siga)+0.5));
p2 = G4std::max(0,int(G4RandGauss::shoot(a2,siga)+0.5));
}
else
p2 = G4Poisson(a2);
@@ -1036,7 +1044,7 @@ G4double G4VEnergyLoss::GetLossWithFluct(const G4DynamicParticle* aParticle,
if(a3>alim)
{
siga=sqrt(a3) ;
p3 = G4std::max(0,int(RandGauss::shoot(a3,siga)+0.5));
p3 = G4std::max(0,int(G4RandGauss::shoot(a3,siga)+0.5));
}
else
p3 = G4Poisson(a3);
@@ -1052,14 +1060,14 @@ G4double G4VEnergyLoss::GetLossWithFluct(const G4DynamicParticle* aParticle,
rfac = dp3/(G4float(nmaxCont2)+dp3);
namean = G4float(p3)*rfac;
sa = G4float(nmaxCont1)*rfac;
na = RandGauss::shoot(namean,sa);
na = G4RandGauss::shoot(namean,sa);
if (na > 0.)
{
alfa = w1*G4float(nmaxCont2+p3)/(w1*G4float(nmaxCont2)+G4float(p3));
alfa1 = alfa*log(alfa)/(alfa-1.);
ea = na*ipotFluct*alfa1;
sea = ipotFluct*sqrt(na*(alfa-alfa1*alfa1));
lossc += RandGauss::shoot(ea,sea);
lossc += G4RandGauss::shoot(ea,sea);
}
}