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
+5 -4
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4Exception.cc,v 1.8 1999/11/29 10:17:46 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4Exception.cc,v 1.9 2000/07/22 10:45:35 asaim Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// ----------------------------------------------------------------------
@@ -21,15 +21,16 @@
#include "G4ios.hh"
#include <stdlib.h>
#include "g4rw/cstring.h"
#include "G4StateManager.hh"
void G4Exception(const char* s)
{
if (s)
if(s)
{
G4cerr << s << G4endl;
}
G4cerr << G4endl << "*** G4Exception: Aborting execution ***" << G4endl;
G4StateManager::GetStateManager()->SetNewState(Abort);
abort();
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4LPhysicsFreeVector.cc,v 1.2 1999/11/16 17:46:51 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4LPhysicsFreeVector.cc,v 1.3 2000/11/20 17:26:48 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// --------------------------------------------------------------------
@@ -53,7 +53,7 @@ G4LPhysicsFreeVector::~G4LPhysicsFreeVector()
void G4LPhysicsFreeVector::DumpValues()
{
for (G4int i = 0; i < numberOfBin; i++) {
for (size_t i = 0; i < numberOfBin; i++) {
// printf(" %12.4f %7.1f\n", binVector(i), dataVector(i)*1.e-27);
printf(" %12.4f %7.1f\n", binVector(i), dataVector(i)/millibarn);
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4PhysicsFreeVector.cc,v 1.2 1999/11/16 17:46:51 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4PhysicsFreeVector.cc,v 1.3 2000/11/20 17:26:48 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
//--------------------------------------------------------------------
@@ -68,7 +68,7 @@ G4PhysicsFreeVector::G4PhysicsFreeVector(const G4DataVector& theBinVector,
ptrNextTable = 0;
for (int i=0; i<numberOfBin; i++) {
for (size_t i=0; i<numberOfBin; i++) {
binVector(i) = theBinVector(i);
dataVector(i) = theDataVector(i);
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4PhysicsLinearVector.cc,v 1.2 1999/11/16 17:46:52 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4PhysicsLinearVector.cc,v 1.3 2000/11/20 17:26:48 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
//--------------------------------------------------------------------
@@ -68,7 +68,7 @@ G4PhysicsLinearVector::G4PhysicsLinearVector(G4double theEmin,
dBin = (theEmax-theEmin) / numberOfBin;
baseBin = theEmin/dBin;
for (G4int i=0; i<numberOfBin+1; i++) {
for (size_t i=0; i<numberOfBin+1; i++) {
binVector(i) = theEmin + i*dBin;
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4PhysicsLnVector.cc,v 1.3 2000/03/23 09:21:24 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4PhysicsLnVector.cc,v 1.4 2000/11/20 17:26:48 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// --------------------------------------------------------------
@@ -63,7 +63,7 @@ G4PhysicsLnVector::G4PhysicsLnVector(G4double theEmin,
dBin = log(theEmax/theEmin) / numberOfBin;
baseBin = log(theEmin)/dBin;
for (G4int i=0; i<numberOfBin+1; i++) {
for (size_t i=0; i<numberOfBin+1; i++) {
binVector(i) = exp(log(theEmin)+i*dBin);
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4PhysicsLogVector.cc,v 1.2 1999/11/16 17:46:52 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4PhysicsLogVector.cc,v 1.3 2000/11/20 17:26:48 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// --------------------------------------------------------------
@@ -66,7 +66,7 @@ G4PhysicsLogVector::G4PhysicsLogVector(G4double theEmin,
dBin = log10(theEmax/theEmin) / numberOfBin;
baseBin = log10(theEmin)/dBin;
for (G4int i=0; i<numberOfBin+1; i++) {
for (size_t i=0; i<numberOfBin+1; i++) {
binVector(i) = pow(10., log10(theEmin)+i*dBin);
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4PhysicsOrderedFreeVector.cc,v 1.2 1999/11/16 17:46:52 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4PhysicsOrderedFreeVector.cc,v 1.3 2000/11/20 17:26:49 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
////////////////////////////////////////////////////////////////////////
// PhysicsOrderedFreeVector Class Implementation
@@ -50,7 +50,7 @@ G4PhysicsOrderedFreeVector::G4PhysicsOrderedFreeVector(G4double *Energies,
numberOfBin = VectorLength;
for (G4int i = 0 ; i < VectorLength ; i++)
for (size_t i = 0 ; i < VectorLength ; i++)
{
binVector.insert(Energies[i]);
dataVector.insert(Values[i]);
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4PhysicsVector.cc,v 1.4 1999/11/23 15:00:05 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4PhysicsVector.cc,v 1.5 2000/11/20 17:26:49 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// --------------------------------------------------------------
@@ -31,14 +31,40 @@ G4PhysicsVector::G4PhysicsVector()
G4PhysicsVector::~G4PhysicsVector() {}
G4PhysicsVector::G4PhysicsVector(const G4PhysicsVector& right)
: edgeMin(right.edgeMin), edgeMax(right.edgeMax),
numberOfBin(right.numberOfBin), lastEnergy(right.lastEnergy),
lastValue(right.lastValue), lastBin(right.lastBin),
dataVector(right.dataVector), binVector(right.binVector),
ptrNextTable(right.ptrNextTable), comment(right.comment) {}
G4PhysicsVector&
G4PhysicsVector::operator=(const G4PhysicsVector& right)
{
if (&right==this) return *this;
edgeMin = right.edgeMin;
edgeMax = right.edgeMax;
numberOfBin = right.numberOfBin;
lastEnergy = right.lastEnergy;
lastValue = right.lastValue;
lastBin = right.lastBin;
dataVector = right.dataVector;
binVector = right.binVector;
ptrNextTable = right.ptrNextTable;
comment = right.comment;
return *this;
}
G4int G4PhysicsVector::operator==(const G4PhysicsVector &right) const
{
return (this == (G4PhysicsVector *) &right);
return (this == &right);
}
G4int G4PhysicsVector::operator!=(const G4PhysicsVector &right) const
{
return (this != (G4PhysicsVector *) &right);
return (this != &right);
}
void G4PhysicsVector::PutValue(size_t binNumber, G4double theValue)
@@ -47,7 +73,7 @@ void G4PhysicsVector::PutValue(size_t binNumber, G4double theValue)
// Fill the bin which is hidden to user with theValue. This is to
// handle correctly when Energy=theEmax in getValue.
if(binNumber=numberOfBin-1) {
if(binNumber==numberOfBin-1) {
dataVector(binNumber+1) = theValue;
}
}
@@ -0,0 +1,172 @@
// 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: G4StateManager.cc,v 1.2 2000/11/20 17:26:49 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// ------------------------------------------------------------
// GEANT 4 class implementation file
//
// For information related to this code contact:
// Geant4 Collaboration
// ---------------- G4StateManager ----------------
// by Gabriele Cosmo, November 1996
// ------------------------------------------------------------
#include "G4StateManager.hh"
// Initialization of the static pointer of the single class instance
G4StateManager* G4StateManager::theStateManager = 0;
G4StateManager::G4StateManager()
:theCurrentState(PreInit),thePreviousState(PreInit)
{ theBottomDependent = 0; }
G4StateManager::~G4StateManager()
{
theDependentsList.clearAndDestroy();
}
G4StateManager::G4StateManager(const G4StateManager &right)
: theCurrentState(right.theCurrentState),
thePreviousState(right.thePreviousState),
theDependentsList(right.theDependentsList),
theBottomDependent(right.theBottomDependent)
{
}
G4StateManager& G4StateManager::operator=(const G4StateManager &right)
{
if (&right == this) return *this;
theCurrentState = right.theCurrentState;
thePreviousState = right.thePreviousState;
theDependentsList = right.theDependentsList;
theBottomDependent = right.theBottomDependent;
return *this;
}
G4int G4StateManager::operator==(const G4StateManager &right) const
{
return (this == &right);
}
G4int G4StateManager::operator!=(const G4StateManager &right) const
{
return (this != &right);
}
G4StateManager* G4StateManager::GetStateManager()
{
if (!theStateManager)
{
theStateManager = new G4StateManager;
}
return theStateManager;
}
G4bool G4StateManager::RegisterDependent(G4VStateDependent* aDependent,G4bool bottom)
{
G4bool ack=true;
if(!bottom)
{ theDependentsList.insert(aDependent); }
else
{
if(theBottomDependent)
{ theDependentsList.insert(theBottomDependent); }
theBottomDependent = aDependent;
}
return ack;
}
G4bool G4StateManager::DeregisterDependent(G4VStateDependent* aDependent)
{
G4VStateDependent* aD = theDependentsList.remove(aDependent);
return (aD != NULL);
}
G4ApplicationState G4StateManager::GetCurrentState()
{
return theCurrentState;
}
G4ApplicationState G4StateManager::GetPreviousState()
{
return thePreviousState;
}
G4bool G4StateManager::SetNewState(G4ApplicationState requestedState)
{
size_t i=0;
G4bool ack = true;
G4ApplicationState savedState = thePreviousState;
thePreviousState = theCurrentState;
theCurrentState = requestedState;
while ((ack) && (i<theDependentsList.entries())) {
ack = theDependentsList(i)->Notify(requestedState);
i++;
}
if(theBottomDependent)
{ ack = theBottomDependent->Notify(requestedState); }
if(!ack)
{
theCurrentState = thePreviousState;
thePreviousState = savedState;
}
return ack;
}
G4VStateDependent* G4StateManager::RemoveDependent(const G4VStateDependent* aDependent)
{
return theDependentsList.remove(aDependent);
}
G4String G4StateManager::GetStateString(G4ApplicationState aState)
{
G4String stateName;
switch(aState)
{
case PreInit:
stateName = "PreInit"; break;
case Init:
stateName = "Init"; break;
case Idle:
stateName = "Idle"; break;
case GeomClosed:
stateName = "GeomClosed"; break;
case EventProc:
stateName = "EventProc"; break;
case Quit:
stateName = "Quit"; break;
case Abort:
stateName = "Abort"; break;
default:
stateName = "Unknown";
}
return stateName;
}
//void G4StateManager::Pause()
//{
// Pause("G4_pause> ");
//}
//
//void G4StateManager::Pause(const char* msg)
//{
// G4String msgS = msg;
// Pause(msgS);
//}
//
//void G4StateManager::Pause(G4String msg)
//{
// G4UImanager::GetUIpointer()->PauseSession(msg);
//}
+1 -1
View File
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4Timer.cc,v 1.8 2000/06/26 16:27:37 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// ----------------------------------------------------------------------
+7 -7
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4UnitsTable.cc,v 1.10 2000/05/25 15:40:48 johna Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4UnitsTable.cc,v 1.11 2000/11/20 17:26:49 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// ------------------------------------------------------------
@@ -97,9 +97,9 @@ G4double G4UnitDefinition::GetValueOf(G4String string)
{
if(theUnitsTable.entries()==0) BuildUnitsTable();
G4String name,symbol;
for (G4int i=0;i<theUnitsTable.entries();i++)
for (size_t i=0;i<theUnitsTable.entries();i++)
{ G4UnitsContainer& units = theUnitsTable[i]->GetUnitsList();
for (G4int j=0;j<units.entries();j++)
for (size_t j=0;j<units.entries();j++)
{ name=units[j]->GetName(); symbol=units[j]->GetSymbol();
if(string==name||string==symbol)
return units[j]->GetValue();
@@ -117,9 +117,9 @@ G4String G4UnitDefinition::GetCategory(G4String string)
{
if(theUnitsTable.entries()==0) BuildUnitsTable();
G4String name,symbol;
for (G4int i=0;i<theUnitsTable.entries();i++)
for (size_t i=0;i<theUnitsTable.entries();i++)
{ G4UnitsContainer& units = theUnitsTable[i]->GetUnitsList();
for (G4int j=0;j<units.entries();j++)
for (size_t j=0;j<units.entries();j++)
{ name=units[j]->GetName(); symbol=units[j]->GetSymbol();
if(string==name||string==symbol)
return theUnitsTable[i]->GetName();
@@ -389,7 +389,7 @@ G4std::ostream& operator<<(G4std::ostream& flux, G4BestUnit a)
G4double value = G4std::max(G4std::max(fabs(a.Value[0]),fabs(a.Value[1])),
fabs(a.Value[2]));
for (G4int k=0; k<List.entries(); k++)
for (size_t k=0; k<List.entries(); k++)
{
G4double unit = List[k]->GetValue();
if (value==DBL_MAX) {if(unit>umax) {umax=unit; ksup=k;}}
@@ -0,0 +1,56 @@
// 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: G4VStateDependent.cc,v 1.2 2000/11/20 17:26:49 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// ------------------------------------------------------------
// GEANT 4 class implementation file
//
// For information related to this code contact:
// Geant4 Collaboration
// ---------------- G4VStateDependent ----------------
// by Gabriele Cosmo, November 1996
// ------------------------------------------------------------
#include "G4VStateDependent.hh"
#include "G4StateManager.hh"
G4VStateDependent::G4VStateDependent(G4bool bottom)
{
G4StateManager * stateManager = G4StateManager::GetStateManager();
stateManager->RegisterDependent(this,bottom);
}
G4VStateDependent::~G4VStateDependent()
{
G4StateManager * stateManager = G4StateManager::GetStateManager();
stateManager->DeregisterDependent(this);
}
G4VStateDependent::G4VStateDependent(const G4VStateDependent &right)
{
*this = right;
}
G4VStateDependent& G4VStateDependent::operator=(const G4VStateDependent &right)
{
if (&right == this) return *this;
*this = right;
return *this;
}
G4int G4VStateDependent::operator==(const G4VStateDependent &right) const
{
return (this == &right);
}
G4int G4VStateDependent::operator!=(const G4VStateDependent &right) const
{
return (this != &right);
}
+1 -1
View File
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4ios.cc,v 1.4 1999/11/23 15:00:06 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// --------------------------------------------------------------