Import Geant4 7.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 11:11:55 +02:00
parent e083ffb441
commit 516dbf1a58
5914 changed files with 202605 additions and 71141 deletions
@@ -0,0 +1,129 @@
//
// ********************************************************************
// * 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: G4AllocatorPool.cc,v 1.2 2004/11/12 16:25:34 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
//
//
// ----------------------------------------------------------------------
// G4AllocatorPool
//
// Implementation file
//
// Author: G.Cosmo, November 2000
//
#include "G4AllocatorPool.hh"
// ************************************************************
// G4AllocatorPool constructor
// ************************************************************
//
G4AllocatorPool::G4AllocatorPool( unsigned int sz )
: esize(sz<sizeof(G4PoolLink) ? sizeof(G4PoolLink) : sz),
csize(sz<1024/2-16 ? 1024-16 : sz*10-16)
{
chunks = 0;
head = 0;
nchunks = 0;
}
// ************************************************************
// G4AllocatorPool copy constructor
// ************************************************************
//
G4AllocatorPool::G4AllocatorPool(const G4AllocatorPool& right)
: esize(right.esize), csize(right.csize)
{
*this = right;
}
// ************************************************************
// G4AllocatorPool operator=
// ************************************************************
//
G4AllocatorPool&
G4AllocatorPool::operator= (const G4AllocatorPool& right)
{
if (&right == this) return *this;
chunks = right.chunks;
head = right.head;
nchunks = right.nchunks;
return *this;
}
// ************************************************************
// G4AllocatorPool destructor
// ************************************************************
//
G4AllocatorPool::~G4AllocatorPool()
{
Reset();
}
// ************************************************************
// Reset
// ************************************************************
//
void G4AllocatorPool::Reset()
{
// Free all chunks
//
G4PoolChunk* n = chunks;
G4PoolChunk* p = 0;
while (n)
{
p = n;
n = n->next;
delete p;
}
head = 0;
chunks = 0;
nchunks = 0;
}
// ************************************************************
// Grow
// ************************************************************
//
void G4AllocatorPool::Grow()
{
// Allocate new chunk, organize it as a linked list of
// elements of size 'esize'
//
G4PoolChunk* n = new G4PoolChunk(csize);
n->next = chunks;
chunks = n;
nchunks++;
const int nelem = csize/esize;
char* start = n->mem;
char* last = &start[(nelem-1)*esize];
for (char* p=start; p<last; p+=esize)
{
reinterpret_cast<G4PoolLink*>(p)->next
= reinterpret_cast<G4PoolLink*>(p+esize);
}
reinterpret_cast<G4PoolLink*>(last)->next = 0;
head = reinterpret_cast<G4PoolLink*>(start);
}
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: G4DataVector.cc,v 1.6 2003/06/06 16:17:16 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
// --------------------------------------------------------------
+5 -6
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4Exception.cc,v 1.17 2003/10/31 17:44:47 asaim Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4Exception.cc,v 1.18 2004/11/12 16:25:34 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
//
//
// ----------------------------------------------------------------------
@@ -35,7 +35,6 @@
// 30.06.95 P.Kent
#include "G4ios.hh"
#include <stdlib.h>
#include "G4String.hh"
#include "G4StateManager.hh"
@@ -55,9 +54,9 @@ void G4Exception(const char* s)
}
void G4Exception(const char* originOfException,
const char* exceptionCode,
G4ExceptionSeverity severity,
const char* description)
const char* exceptionCode,
G4ExceptionSeverity severity,
const char* description)
{
G4VExceptionHandler* exceptionHandler
= G4StateManager::GetStateManager()->GetExceptionHandler();
@@ -22,7 +22,7 @@
//
//
// $Id: G4LPhysicsFreeVector.cc,v 1.8 2001/07/11 10:00:56 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
// --------------------------------------------------------------------
@@ -22,7 +22,7 @@
//
//
// $Id: G4OrderedTable.cc,v 1.3 2003/06/06 16:17:17 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
// ------------------------------------------------------------
@@ -22,7 +22,7 @@
//
//
// $Id: G4PhysicsFreeVector.cc,v 1.8 2001/07/11 10:00:57 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
//--------------------------------------------------------------------
@@ -22,7 +22,7 @@
//
//
// $Id: G4PhysicsLinearVector.cc,v 1.10 2003/06/06 16:17:17 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
//--------------------------------------------------------------------
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4PhysicsLnVector.cc,v 1.12 2003/06/06 16:17:17 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4PhysicsLnVector.cc,v 1.13 2004/11/12 17:38:35 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
//
//
// --------------------------------------------------------------
@@ -84,11 +84,11 @@ G4PhysicsLnVector::G4PhysicsLnVector(G4double theEmin,
binVector.reserve(theNbin+1);
numberOfBin = theNbin;
dBin = log(theEmax/theEmin) / numberOfBin;
baseBin = log(theEmin)/dBin;
dBin = std::log(theEmax/theEmin) / numberOfBin;
baseBin = std::log(theEmin)/dBin;
for (size_t i=0; i<numberOfBin+1; i++) {
binVector.push_back(exp(log(theEmin)+i*dBin));
binVector.push_back(std::exp(std::log(theEmin)+i*dBin));
dataVector.push_back(0.0);
}
@@ -108,8 +108,8 @@ G4bool G4PhysicsLnVector::Retrieve(std::ifstream& fIn, G4bool ascii)
G4bool success = G4PhysicsVector::Retrieve(fIn, ascii);
if (success){
G4double theEmin = binVector[0];
dBin = log(binVector[1]/theEmin);
baseBin = log(theEmin)/dBin;
dBin = std::log(binVector[1]/theEmin);
baseBin = std::log(theEmin)/dBin;
}
return success;
}
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4PhysicsLogVector.cc,v 1.10 2003/06/06 16:17:17 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4PhysicsLogVector.cc,v 1.11 2004/11/12 17:38:35 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
//
//
// --------------------------------------------------------------
@@ -88,11 +88,11 @@ G4PhysicsLogVector::G4PhysicsLogVector(G4double theEmin,
binVector.reserve(theNbin+1);
numberOfBin = theNbin;
dBin = log10(theEmax/theEmin) / numberOfBin;
baseBin = log10(theEmin)/dBin;
dBin = std::log10(theEmax/theEmin) / numberOfBin;
baseBin = std::log10(theEmin)/dBin;
for (size_t i=0; i<numberOfBin+1; i++) {
binVector.push_back(pow(10., log10(theEmin)+i*dBin));
binVector.push_back(std::pow(10., std::log10(theEmin)+i*dBin));
dataVector.push_back(0.0);
}
@@ -112,8 +112,8 @@ G4bool G4PhysicsLogVector::Retrieve(std::ifstream& fIn, G4bool ascii)
G4bool success = G4PhysicsVector::Retrieve(fIn, ascii);
if (success){
G4double theEmin = binVector[0];
dBin = log10(binVector[1]/theEmin);
baseBin = log10(theEmin)/dBin;
dBin = std::log10(binVector[1]/theEmin);
baseBin = std::log10(theEmin)/dBin;
}
return success;
}
@@ -22,7 +22,7 @@
//
//
// $Id: G4PhysicsOrderedFreeVector.cc,v 1.8 2001/07/11 10:00:57 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
////////////////////////////////////////////////////////////////////////
// PhysicsOrderedFreeVector Class Implementation
+43 -8
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4PhysicsTable.cc,v 1.10 2003/11/04 12:17:30 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4PhysicsTable.cc,v 1.12 2004/10/29 11:38:08 kurasige Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
// ------------------------------------------------------------
@@ -47,6 +47,7 @@ G4PhysicsTable::G4PhysicsTable(size_t capacity)
: G4PhysCollection()
{
reserve(capacity);
vecFlag.reserve(capacity);
}
G4PhysicsTable::G4PhysicsTable(const G4PhysicsTable& right)
@@ -60,9 +61,11 @@ G4PhysicsTable& G4PhysicsTable::operator=(const G4PhysicsTable& right)
if (this != &right)
{
G4PhysCollection::const_iterator itr;
for (itr=right.begin(); itr!=right.end(); ++itr)
{
size_t idx = 0;
for (itr=right.begin(); itr!=right.end(); ++itr ) {
G4PhysCollection::push_back(*itr);
vecFlag.push_back(right.GetFlag(idx));
idx +=1;
}
}
return *this;
@@ -70,9 +73,16 @@ G4PhysicsTable& G4PhysicsTable::operator=(const G4PhysicsTable& right)
G4PhysicsTable::~G4PhysicsTable()
{
clear();
G4PhysCollection::clear();
vecFlag.clear();
}
void G4PhysicsTable::resize(size_t size, G4PhysicsVector* vec)
{
G4PhysCollection::resize(size, vec);
vecFlag.resize(size, true);
}
G4bool G4PhysicsTable::StorePhysicsTable(const G4String& fileName,
G4bool ascii)
@@ -88,7 +98,7 @@ G4bool G4PhysicsTable::StorePhysicsTable(const G4String& fileName,
// check if the file has been opened successfully
if (!fOut) {
#ifdef G4VERBOSE
G4cerr << "G4PhysicsTable::::StorePhysicsTable ";
G4cerr << "G4PhysicsTable::StorePhysicsTable ";
G4cerr << " Can not open file " << fileName << G4endl;
#endif
fOut.close();
@@ -165,6 +175,7 @@ G4bool G4PhysicsTable::RetrievePhysicsTable(const G4String& fileName,
fIn >> tableSize;
}
reserve(tableSize);
vecFlag.clear();
// Physics Vector
for (size_t idx=0; idx<tableSize; ++idx) {
@@ -196,7 +207,9 @@ G4bool G4PhysicsTable::RetrievePhysicsTable(const G4String& fileName,
}
// add a PhysicsVector to this PhysicsTable
push_back(pVec);
G4PhysCollection::push_back(pVec);
vecFlag.push_back(true);
}
fIn.close();
return true;
@@ -210,7 +223,14 @@ std::ostream& operator<<(std::ostream& out,
size_t i=0;
for (itr=right.begin(); itr!=right.end(); ++itr) {
out << std::setw(8) << i << "-th Vector ";
out << ": Type " << G4int((*itr)->GetType()) << G4endl;
out << ": Type " << G4int((*itr)->GetType()) ;
out << ": Flag ";
if (right.GetFlag(i)) {
out << " T";
} else {
out << " F";
}
out << G4endl;
out << *(*itr);
i +=1;
}
@@ -218,6 +238,15 @@ std::ostream& operator<<(std::ostream& out,
return out;
}
void G4PhysicsTable::ResetFlagArray()
{
size_t tableSize = G4PhysCollection::size();
vecFlag.clear();
for (size_t idx=0; idx<tableSize; idx++){
vecFlag.push_back(true);
}
}
#include "G4PhysicsVectorType.hh"
#include "G4LPhysicsFreeVector.hh"
#include "G4PhysicsLogVector.hh"
@@ -262,3 +291,9 @@ G4PhysicsVector* G4PhysicsTable::CreatePhysicsVector(G4int type)
return pVector;
}
@@ -22,7 +22,7 @@
//
//
// $Id: G4PhysicsVector.cc,v 1.15 2003/06/06 16:17:17 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
// --------------------------------------------------------------
@@ -22,7 +22,7 @@
//
//
// $Id: G4StateManager.cc,v 1.10 2003/10/31 17:44:47 asaim Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
// ------------------------------------------------------------
+3 -3
View File
@@ -21,15 +21,15 @@
// ********************************************************************
//
//
// $Id: G4Timer.cc,v 1.11 2003/06/06 16:17:17 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4Timer.cc,v 1.13 2004/11/22 08:14:35 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
//
//
// ----------------------------------------------------------------------
// class G4Timer
//
// Implementation
// 29.04.97 G.Cosmo Added timings for Windows/NT
// 29.04.97 G.Cosmo Added timings for Windows systems
#include "G4Timer.hh"
#include "G4ios.hh"
+4 -4
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4UnitsTable.cc,v 1.21 2004/01/21 13:17:50 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4UnitsTable.cc,v 1.22 2004/11/12 17:38:35 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//
@@ -416,8 +416,8 @@ std::ostream& operator<<(std::ostream& flux, G4BestUnit a)
G4double rsup(DBL_MAX), rinf(0.);
//for a ThreeVector, choose the best unit for the biggest value
G4double value = std::max(std::max(fabs(a.Value[0]),fabs(a.Value[1])),
fabs(a.Value[2]));
G4double value = std::max(std::max(std::fabs(a.Value[0]),std::fabs(a.Value[1])),
std::fabs(a.Value[2]));
for (size_t k=0; k<List.size(); k++)
{
@@ -22,7 +22,7 @@
//
//
// $Id: G4VExceptionHandler.cc,v 1.1 2002/08/19 18:20:12 asaim Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
// ------------------------------------------------------------
@@ -22,7 +22,7 @@
//
//
// $Id: G4VStateDependent.cc,v 1.3 2001/07/11 10:00:59 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
// ------------------------------------------------------------
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: G4ios.cc,v 1.8 2004/06/11 14:18:59 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
// --------------------------------------------------------------