Import Geant4 9.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 15:37:50 +02:00
parent a8e9364cea
commit 96c8bcd0af
6923 changed files with 198390 additions and 41849 deletions
+1 -1
View File
@@ -25,7 +25,7 @@
//
//
// $Id: G4CellScorer.cc,v 1.4 2006/06/29 18:09:31 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
+1 -1
View File
@@ -25,7 +25,7 @@
//
//
// $Id: G4CellScorerStore.cc,v 1.4 2006/06/29 18:09:33 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
+1 -1
View File
@@ -25,7 +25,7 @@
//
//
// $Id: G4EvManMessenger.cc,v 1.6 2006/11/03 03:11:13 asaim Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// --------------------------------------------------------------------
+1 -1
View File
@@ -25,7 +25,7 @@
//
//
// $Id: G4Event.cc,v 1.14 2007/03/07 02:44:16 asaim Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// G4Event
+1 -1
View File
@@ -25,7 +25,7 @@
//
//
// $Id: G4EventManager.cc,v 1.30 2007/03/08 23:56:12 asaim Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
//
//
+1 -1
View File
@@ -25,7 +25,7 @@
//
//
// $Id: G4HEPEvtInterface.cc,v 1.11 2006/06/29 18:09:48 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
//
// --------------------------------------------------------------------
+1 -1
View File
@@ -25,7 +25,7 @@
//
//
// $Id: G4HEPEvtParticle.cc,v 1.8 2006/06/29 18:09:50 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
//
+86 -14
View File
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4ParticleGun.cc,v 1.12 2006/06/29 18:09:53 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// $Id: G4ParticleGun.cc,v 1.14 2007/11/07 17:13:19 asaim Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
// G4ParticleGun
@@ -61,6 +61,7 @@ void G4ParticleGun::SetInitialValues()
G4ThreeVector zero;
particle_momentum_direction = (G4ParticleMomentum)zero;
particle_energy = 0.0;
particle_momentum = 0.0;
particle_position = zero;
particle_time = 0.0;
particle_polarization = zero;
@@ -73,6 +74,19 @@ G4ParticleGun::~G4ParticleGun()
delete theMessenger;
}
G4ParticleGun::G4ParticleGun(const G4ParticleGun& /*right*/)
:G4VPrimaryGenerator()
{ G4Exception("G4ParticleGun : Copy constructor should not be used."); }
const G4ParticleGun& G4ParticleGun::operator=(const G4ParticleGun& right)
{ G4Exception("G4ParticleGun : Equal operator should not be used."); return right; }
G4int G4ParticleGun::operator==(const G4ParticleGun& /*right*/) const
{ G4Exception("G4ParticleGun : == operator should not be used."); return true; }
G4int G4ParticleGun::operator!=(const G4ParticleGun& /*right*/) const
{ G4Exception("G4ParticleGun : == operator should not be used."); return false; }
void G4ParticleGun::SetParticleDefinition
(G4ParticleDefinition * aParticleDefinition)
{
@@ -93,33 +107,91 @@ void G4ParticleGun::SetParticleDefinition
}
particle_definition = aParticleDefinition;
particle_charge = particle_definition->GetPDGCharge();
if(particle_momentum>0.0)
{
G4double mass = particle_definition->GetPDGMass();
particle_energy =
std::sqrt(particle_momentum*particle_momentum+mass*mass)-mass;
}
}
void G4ParticleGun::SetParticleEnergy(G4double aKineticEnergy)
{
particle_energy = aKineticEnergy;
if(particle_momentum>0.0){
if(particle_definition){
G4cout << "G4ParticleGun::" << particle_definition->GetParticleName()
<< G4endl;
}else{
G4cout << "G4ParticleGun::" << " " << G4endl;
}
G4cout << " was defined in terms of Momentum: "
<< particle_momentum/GeV << "GeV/c" << G4endl;
G4cout << " is now defined in terms of KineticEnergy: "
<< particle_energy/GeV << "GeV" << G4endl;
particle_momentum = 0.0;
}
}
void G4ParticleGun::SetParticleMomentum(G4double aMomentum)
{
if(particle_energy>0.0){
if(particle_definition){
G4cout << "G4ParticleGun::" << particle_definition->GetParticleName()
<< G4endl;
}else{
G4cout << "G4ParticleGun::" << " " << G4endl;
}
G4cout << " was defined in terms of KineticEnergy: "
<< particle_energy/GeV << "GeV" << G4endl;
G4cout << " is now defined in terms Momentum: "
<< aMomentum/GeV << "GeV/c" << G4endl;
}
if(particle_definition==0)
{
G4cout <<"Particle Definition not defined yet for G4ParticleGun"<< G4endl;
G4cout <<"Zero Mass is assumed"<<G4endl;
particle_momentum = aMomentum;
particle_energy = aMomentum;
}
else
{
G4double mass = particle_definition->GetPDGMass();
particle_momentum = aMomentum;
particle_energy =
std::sqrt(particle_momentum*particle_momentum+mass*mass)-mass;
}
}
void G4ParticleGun::SetParticleMomentum(G4ParticleMomentum aMomentum)
{
if(particle_energy>0.0){
if(particle_definition){
G4cout << "G4ParticleGun::" << particle_definition->GetParticleName()
<< G4endl;
}else{
G4cout << "G4ParticleGun::" << " " << G4endl;
}
G4cout << " was defined in terms of KineticEnergy: "
<< particle_energy/GeV << "GeV" << G4endl;
G4cout << " is now defined in terms Momentum: "
<< aMomentum.mag()/GeV << "GeV/c" << G4endl;
}
if(particle_definition==0)
{
G4cout <<"Particle Definition not defined yet for G4ParticleGun"<< G4endl;
G4cout <<"Zero Mass is assumed"<<G4endl;
particle_momentum_direction = aMomentum.unit();
particle_momentum = aMomentum.mag();
particle_energy = aMomentum.mag();
}
else
{
G4double mass = particle_definition->GetPDGMass();
G4double p = aMomentum.mag();
particle_momentum = aMomentum.mag();
particle_momentum_direction = aMomentum.unit();
if ((particle_energy>0.0)&&(std::abs(particle_energy+mass-std::sqrt(p*p+mass*mass))>keV))
{
G4cout << "G4ParticleGun::" << particle_definition->GetParticleName() << G4endl;
G4cout << " KineticEnergy and Momentum could be inconsistent" << G4endl;
G4cout << " (Momentum:" << p/GeV << " GeV/c";
G4cout << " Mass:" << mass/GeV << " GeV/c/c)" << G4endl;
G4cout << " KineticEnergy is overwritten!! ";
G4cout << particle_energy/GeV << "->";
G4cout << (std::sqrt(p*p+mass*mass)-mass)/GeV << "GeV" << G4endl;
}
particle_energy = std::sqrt(p*p+mass*mass)-mass;
particle_energy =
std::sqrt(particle_momentum*particle_momentum+mass*mass)-mass;
}
}
+43 -5
View File
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4ParticleGunMessenger.cc,v 1.14 2006/06/29 18:09:55 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// $Id: G4ParticleGunMessenger.cc,v 1.16 2007/10/02 00:45:17 asaim Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
#include "G4ParticleGunMessenger.hh"
@@ -79,8 +79,8 @@ G4ParticleGunMessenger::G4ParticleGunMessenger(G4ParticleGun * fPtclGun)
directionCmd = new G4UIcmdWith3Vector("/gun/direction",this);
directionCmd->SetGuidance("Set momentum direction.");
directionCmd->SetGuidance("Direction needs not to be a unit vector.");
directionCmd->SetParameterName("Px","Py","Pz",true,true);
directionCmd->SetRange("Px != 0 || Py != 0 || Pz != 0");
directionCmd->SetParameterName("ex","ey","ez",true,true);
directionCmd->SetRange("ex != 0 || ey != 0 || ez != 0");
energyCmd = new G4UIcmdWithADoubleAndUnit("/gun/energy",this);
energyCmd->SetGuidance("Set kinetic energy.");
@@ -89,6 +89,19 @@ G4ParticleGunMessenger::G4ParticleGunMessenger(G4ParticleGun * fPtclGun)
//energyCmd->SetUnitCategory("Energy");
//energyCmd->SetUnitCandidates("eV keV MeV GeV TeV");
momCmd = new G4UIcmdWith3VectorAndUnit("/gun/momentum",this);
momCmd->SetGuidance("Set momentum. This command is equivalent to two commands /gun/direction and /gun/momentumAmp");
momCmd->SetParameterName("px","py","pz",true,true);
momCmd->SetRange("px != 0 || py != 0 || pz != 0");
momCmd->SetDefaultUnit("GeV");
momAmpCmd = new G4UIcmdWithADoubleAndUnit("/gun/momentumAmp",this);
momAmpCmd->SetGuidance("Set absolute value of momentum.");
momAmpCmd->SetGuidance("Direction should be set by /gun/direction command.");
momAmpCmd->SetGuidance("This command should be used alternatively with /gun/energy.");
momAmpCmd->SetParameterName("Momentum",true,true);
momAmpCmd->SetDefaultUnit("GeV");
positionCmd = new G4UIcmdWith3VectorAndUnit("/gun/position",this);
positionCmd->SetGuidance("Set starting position of the particle.");
positionCmd->SetParameterName("X","Y","Z",true,true);
@@ -149,6 +162,8 @@ G4ParticleGunMessenger::~G4ParticleGunMessenger()
delete particleCmd;
delete directionCmd;
delete energyCmd;
delete momCmd;
delete momAmpCmd;
delete positionCmd;
delete timeCmd;
delete polCmd;
@@ -176,6 +191,10 @@ void G4ParticleGunMessenger::SetNewValue(G4UIcommand * command,G4String newValue
{ fParticleGun->SetParticleMomentumDirection(directionCmd->GetNew3VectorValue(newValues)); }
else if( command==energyCmd )
{ fParticleGun->SetParticleEnergy(energyCmd->GetNewDoubleValue(newValues)); }
else if( command==momCmd )
{ fParticleGun->SetParticleMomentum(momCmd->GetNew3VectorValue(newValues)); }
else if( command==momAmpCmd )
{ fParticleGun->SetParticleMomentum(momAmpCmd->GetNewDoubleValue(newValues)); }
else if( command==positionCmd )
{ fParticleGun->SetParticlePosition(positionCmd->GetNew3VectorValue(newValues)); }
else if( command==timeCmd )
@@ -197,7 +216,26 @@ G4String G4ParticleGunMessenger::GetCurrentValue(G4UIcommand * command)
else if( command==particleCmd )
{ cv = fParticleGun->GetParticleDefinition()->GetParticleName(); }
else if( command==energyCmd )
{ cv = energyCmd->ConvertToString(fParticleGun->GetParticleEnergy(),"GeV"); }
{
G4double ene = fParticleGun->GetParticleEnergy();
if(ene == 0.)
{ G4cerr << " G4ParticleGun: was defined in terms of momentum." << G4endl; }
else
{ cv = energyCmd->ConvertToString(ene,"GeV"); }
}
else if( command==momCmd || command==momAmpCmd )
{
G4double mom = fParticleGun->GetParticleMomentum();
if(mom == 0.)
{ G4cerr << " G4ParticleGun: was defined in terms of kinetic energy." << G4endl; }
else
{
if( command==momCmd )
{ cv = momCmd->ConvertToString(mom*(fParticleGun->GetParticleMomentumDirection()),"GeV"); }
else
{ cv = momAmpCmd->ConvertToString(mom,"GeV"); }
}
}
else if( command==positionCmd )
{ cv = positionCmd->ConvertToString(fParticleGun->GetParticlePosition(),"cm"); }
else if( command==timeCmd )
+1 -1
View File
@@ -25,7 +25,7 @@
//
//
// $Id: G4PrimaryTransformer.cc,v 1.27 2006/06/29 18:09:58 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
#include "G4PrimaryTransformer.hh"
+1 -1
View File
@@ -25,7 +25,7 @@
//
//
// $Id: G4RayShooter.cc,v 1.2 2006/06/29 18:10:00 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
#include "G4RayShooter.hh"
+2 -2
View File
@@ -225,7 +225,7 @@ void G4SPSEneDistribution::CalculateCdgSpectrum()
{
omalpha = 1. - spind[i];
CDGhist[i+1] = CDGhist[i] + (pfact[i]/omalpha)*
(std::pow(ene_line[i+1],omalpha)-std::pow(ene_line[i],omalpha));
(std::pow(ene_line[i+1]/keV,omalpha)-std::pow(ene_line[i]/keV,omalpha));
i++;
}
@@ -893,7 +893,7 @@ void G4SPSEneDistribution::GenerateCdgEnergies()
omalpha[0] = 1. - 1.4;
omalpha[1] = 1. - 2.3;
ene_line[0] = Emin;
ene_line[1] = 18.;
ene_line[1] = 18.*keV;
ene_line[2] = Emax;
}
if(Emin > 18*keV)
+1 -1
View File
@@ -25,7 +25,7 @@
//
//
// $Id: G4StackChecker.cc,v 1.2 2006/06/29 18:10:17 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
#include "G4StackChecker.hh"
+1 -1
View File
@@ -25,7 +25,7 @@
//
//
// $Id: G4StackManager.cc,v 1.10 2006/06/29 18:10:19 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
//
// Last Modification : 09/Dec/96 M.Asai
+1 -1
View File
@@ -25,7 +25,7 @@
//
//
// $Id: G4StackedTrack.cc,v 1.9 2006/06/29 18:10:21 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
//
// Last Modification : 02/Feb/96 M.Asai
+1 -1
View File
@@ -25,7 +25,7 @@
//
//
// $Id: G4StackingMessenger.cc,v 1.5 2006/06/29 18:10:23 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// --------------------------------------------------------------------
+1 -1
View File
@@ -25,7 +25,7 @@
//
//
// $Id: G4TrackStack.cc,v 1.6 2006/06/29 18:10:26 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
#include "G4TrackStack.hh"
+1 -1
View File
@@ -25,7 +25,7 @@
//
//
// $Id: G4TrajectoryContainer.cc,v 1.5 2006/06/29 18:10:28 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
#include "G4TrajectoryContainer.hh"
+1 -1
View File
@@ -25,7 +25,7 @@
//
//
// $Id: G4UserEventAction.cc,v 1.7 2006/06/29 18:10:31 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
#include "G4UserEventAction.hh"
+1 -1
View File
@@ -25,7 +25,7 @@
//
//
// $Id: G4UserStackingAction.cc,v 1.7 2006/06/29 18:10:33 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
#include "G4UserStackingAction.hh"
+1 -1
View File
@@ -25,7 +25,7 @@
//
//
// $Id: G4VPrimaryGenerator.cc,v 1.5 2006/06/29 18:10:35 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// G4VPrimaryGenerator