Import Geant4 3.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 16:03:00 +02:00
parent cfcb558cfe
commit 137e303ecc
2843 changed files with 37082 additions and 38426 deletions
+14 -1
View File
@@ -1,4 +1,4 @@
# $Id: GNUmakefile,v 1.2 2000/11/03 16:40:30 gunter Exp $
# $Id: GNUmakefile,v 1.3 2001/04/05 09:02:19 gcosmo Exp $
# --------------------------------------------------------------
# GNUmakefile for global management. Gabriele Cosmo, 26/9/96.
# --------------------------------------------------------------
@@ -13,6 +13,19 @@ include $(G4INSTALL)/config/architecture.gmk
include $(G4INSTALL)/config/common.gmk
# Fix for Solaris CC 5.2 Patch 109508-02 to compile without optimization.
#
CXXFLAGS_WITHOUT_O := $(filter-out -O% , $(CXXFLAGS))
CXXFLAGS_WITHOUT_O := $(filter-out +O% , $(CXXFLAGS_WITHOUT_O))
ifeq ($(G4SYSTEM),SUN-CC5)
COMPILER := $(shell CC -V 2>&1)
ifeq ($(findstring 109508-02,$(COMPILER)),109508-02)
$(G4TMP)/$(G4SYSTEM)/$(name)/G4UnitsTable.o: src/G4UnitsTable.cc
@echo Compiling G4UnitsTable.cc ...
@$(CXX) $(CXXFLAGS_WITHOUT_O) $(CPPFLAGS) -c $(OUT_OBJ)$@ src/G4UnitsTable.cc
endif
endif
G4DUMMY_VARIABLE:=$(shell [ ! -d $(G4INCLUDE)/g4std ] && mkdir -p $(G4INCLUDE)/g4std )
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4Allocator.hh,v 1.5 2000/11/20 20:16:50 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4Allocator.hh,v 1.6 2001/01/09 07:50:57 stesting Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// ------------------------------------------------------------
@@ -103,7 +103,7 @@ G4Allocator<Type>::~G4Allocator()
{
aNextPage = aPage->fNext;
free(aPage->fUnits);
free(aPage);
delete aPage;
aPage = aNextPage;
}
fPages = NULL;
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4AllocatorPage.hh,v 1.2 1999/11/16 17:40:22 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// ------------------------------------------------------------
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4AllocatorUnit.hh,v 1.2 1999/11/16 17:40:22 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// ------------------------------------------------------------
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4ApplicationState.hh,v 1.1 2000/07/22 10:45:34 asaim Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
#ifndef G4APPLICATIONSTATE_H
@@ -5,20 +5,127 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4DataVector.hh,v 1.4 1999/11/23 15:00:03 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4DataVector.hh,v 1.7 2001/03/06 15:56:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// ------------------------------------------------------------
// GEANT 4 class header file
// ------------------------------------------------------------
//
// Class Description:
//
// Utility class providing similar behaviour of vector<G4double>.
// It includes additional methods for compatibility with Rogue Wave
// collection.
//
#ifndef G4DataVector_h
#define G4DataVector_h 1
#include "globals.hh"
#include "g4rw/tvordvec.h"
#include "g4std/vector"
typedef G4RWTValOrderedVector<G4double> G4DataVector;
class G4DataVector : public G4std::vector<G4double>
{
public: // with description
G4DataVector();
// Default constructor.
G4DataVector(size_t capacity);
// Constructor given a 'capacity' defining the initial number of elements.
virtual ~G4DataVector(){;}
// Empty destructor
inline void insertAt(size_t, const G4double&);
// Insert an element at given position
inline size_t index(const G4double&);
// Returns back index of the element same as given value
inline G4bool contains(const G4double&) const;
// Returns 'true' if it contains the element same as given value
inline G4bool remove(const G4double&);
// Removes the first element same as given value
inline size_t removeAll(const G4double&);
// Remove all elements same as given value
};
inline
G4DataVector::G4DataVector()
: G4std::vector<G4double>()
{
}
inline
G4DataVector::G4DataVector(size_t capacity)
: G4std::vector<G4double>(capacity)
{
}
inline
void G4DataVector::insertAt(size_t pos, const G4double& a)
{
iterator i = begin();
for (size_t ptn=0; (ptn<pos)&&(i!=end()); i++,ptn++);
if (i==end())
push_back(a);
else
insert(i,a);
}
inline
size_t G4DataVector::index(const G4double& a)
{
size_t ptn = 0;
for (iterator i=begin(); i!=end(); i++,ptn++)
if (*i==a) return ptn;
return (ptn=~(size_t)0);
}
inline
G4bool G4DataVector::contains(const G4double& a) const
{
for (const_iterator i=begin(); i!=end(); i++)
if (*i==a) return true;
return false;
}
inline
G4bool G4DataVector::remove(const G4double& a)
{
G4bool found =false;
for (iterator i=begin(); i!=end(); i++){
if (*i==a) {
erase(i);
found = true;
break;
}
}
return found;
}
inline
size_t G4DataVector::removeAll(const G4double& a)
{
size_t ptn=0;
for (iterator i=begin(); i!=end(); i++){
if (*i==a) {
erase(i);
ptn++;
i--;
}
}
return ptn;
}
#endif
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4FastVector.hh,v 1.3 1999/11/23 15:00:03 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// ------------------------------------------------------------
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4LPhysicsFreeVector.hh,v 1.2 1999/11/16 17:40:38 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4LPhysicsFreeVector.hh,v 1.6 2001/03/09 12:08:18 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// ------------------------------------------------------------------
@@ -27,6 +27,7 @@
//
// 27-MAR-97 FWJ: first version for Alpha release
// 20-JUN-97 FWJ: added comment re GetValue(): no longer virtual
// 11-NOV-00 H.Kurashige: use STL vector for dataVector and binVector
//
#ifndef G4LPhysicsFreeVector_h
@@ -36,19 +37,23 @@
class G4LPhysicsFreeVector : public G4PhysicsVector
{
public:
public:
G4LPhysicsFreeVector();
public: // with description
G4LPhysicsFreeVector(size_t nbin, G4double binmin, G4double binmax);
~G4LPhysicsFreeVector();
void PutValues(size_t binNumber, G4double binValue, G4double dataValue);
// G4PhysicsVector has PutValue() but it is inconvenient.
// Want to simultaneously fill the bin and data vectors.
// G4PhysicsVector has PutValue() but it is inconvenient.
// Want to simultaneously fill the bin and data vectors.
G4double GetValue(G4double theEnergy, G4bool& isOutRange);
// Note that theEnergy could be energy, momentum, or whatever.
// Note that theEnergy could be energy, momentum, or whatever.
void SetVerboseLevel(G4int value);
@@ -65,7 +70,7 @@ private:
G4int verboseLevel;
size_t FindBinLocation(G4double theEnergy) const;
// Pure virtual in G4PhysicsVector
// Pure virtual in G4PhysicsVector
};
#include "G4LPhysicsFreeVector.icc"
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4LPhysicsFreeVector.icc,v 1.2 1999/11/23 15:00:03 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4LPhysicsFreeVector.icc,v 1.4 2001/01/09 11:26:57 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// ------------------------------------------------------------------
@@ -28,8 +28,8 @@
inline
void G4LPhysicsFreeVector::PutValues(size_t binNumber, G4double binValue, G4double dataValue)
{
binVector(binNumber) = binValue;
dataVector(binNumber) = dataValue;
binVector[binNumber] = binValue;
dataVector[binNumber] = dataValue;
}
// Note that theEnergy could be energy, momentum, or whatever.
@@ -47,33 +47,35 @@ G4double G4LPhysicsFreeVector::GetValue(G4double theEnergy, G4bool& isOutRange)
if (theEnergy < edgeMin) {
isOutRange = true;
#ifdef G4VERBOSE
if (verboseLevel > 1) G4cout << "G4LPhysicsFreeVector::GetValue " <<
theEnergy << " " << dataVector(0) << " " << isOutRange << G4endl;
returnValue = dataVector(0);
theEnergy << " " << dataVector[0] << " " << isOutRange << G4endl;
#endif
returnValue = dataVector[0];
}
else if (theEnergy > edgeMax) {
isOutRange = true;
#ifdef G4VERBOSE
if (verboseLevel > 1) G4cout << "G4LPhysicsFreeVector::GetValue " <<
theEnergy << " " << dataVector(numberOfBin - 1) << " " <<
theEnergy << " " << dataVector[numberOfBin - 1] << " " <<
isOutRange << G4endl;
returnValue = dataVector(numberOfBin - 1);
#endif
returnValue = dataVector[numberOfBin - 1];
}
else {
isOutRange = false;
G4int n = FindBinLocation(theEnergy);
G4double dsde = (dataVector(n + 1) - dataVector(n))/
(binVector(n + 1) - binVector(n));
G4double dsde = (dataVector[n + 1] - dataVector[n])/
(binVector[n + 1] - binVector[n]);
#ifdef G4VERBOSE
if (verboseLevel > 1) G4cout << "G4LPhysicsFreeVector::GetValue " <<
theEnergy << " " << dataVector(n) + (theEnergy - binVector(n))*dsde <<
theEnergy << " " << dataVector[n] + (theEnergy - binVector[n])*dsde <<
" " << isOutRange << G4endl;
returnValue = dataVector(n) + (theEnergy - binVector(n))*dsde;
#endif
returnValue = dataVector[n] + (theEnergy - binVector[n])*dsde;
}
return returnValue;
}
@@ -109,13 +111,15 @@ size_t G4LPhysicsFreeVector::FindBinLocation(G4double theEnergy) const
G4int n2 = numberOfBin/2;
G4int n3 = numberOfBin - 1;
while (n1 != n3 - 1) {
if (theEnergy > binVector(n2))
if (theEnergy > binVector[n2])
n1 = n2;
else
n3 = n2;
n2 = n1 + (n3 - n1 + 1)/2;
}
#ifdef G4VERBOSE
if (verboseLevel > 1) G4cout <<
"G4LPhysicsFreeVector::FindBinLocation: returning " << n1 << G4endl;
#endif
return (size_t)n1;
}
@@ -5,43 +5,80 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4OrderedTable.hh,v 1.4 1999/11/16 17:40:39 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4OrderedTable.hh,v 1.7 2001/03/06 15:56:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// ------------------------------------------------------------
// GEANT 4 class header file
// ------------------------------------------------------------
// Sep. 1996 : M.Maire
// Jan. 2001 : H.Kurashige
// - G4ValVector is replaced with G4DataVector
// - Migrated to G4std::vector<G4DataVector*>.
//
// This class is setting up an ordered collection of
// ordered vectors of <G4double>
// 30 September 1996, M.Maire
// Class Description:
//
// Utility class, defining an ordered collection of vectors
// of <G4double>.
// ------------------------------------------------------------
#ifndef G4OrderedTable_h
#define G4OrderedTable_h 1
#include "globals.hh"
#include "g4rw/tvordvec.h"
#include "g4rw/tpordvec.h"
#include "g4std/vector"
#include "G4DataVector.hh"
class G4ValVector : public G4RWTValOrderedVector<G4double>
class G4OrderedTable : public G4std::vector<G4DataVector*>
{
public:
public: // with description
G4ValVector(size_t capac=G4RWDEFAULT_CAPACITY)
: G4RWTValOrderedVector<G4double>(capac) {;}
G4OrderedTable();
// Deafult constructor.
virtual ~G4ValVector() {;}
G4OrderedTable(size_t capacity);
// Constructor given a 'capacity' defining the initial
// number of elements (NULL pointers are filled up)
virtual ~G4OrderedTable(){;}
// Empty Destructor
G4bool operator==(const G4ValVector &right) const
{
return (this == (G4ValVector *) &right);
}
inline void clearAndDestroy();
// Removes all elements and deletes all non-NULL pointers
};
typedef G4RWTPtrOrderedVector<G4ValVector> G4OrderedTable;
inline
G4OrderedTable::G4OrderedTable()
: G4std::vector<G4DataVector*>()
{
}
inline
G4OrderedTable::G4OrderedTable(size_t capacity)
: G4std::vector<G4DataVector*>(capacity, (G4DataVector*)(0) )
{
}
inline
void G4OrderedTable::clearAndDestroy()
{
G4DataVector* a;
while (size()>0) {
a = back();
pop_back();
for (iterator i=begin(); i!=end(); i++){
if (*i==a) {
erase(i);
i--;
}
}
if ( a ) delete a;
}
}
#endif
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4PhysicsFreeVector.hh,v 1.3 2000/11/20 17:26:46 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4PhysicsFreeVector.hh,v 1.7 2001/03/09 12:08:18 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
//--------------------------------------------------------------------
@@ -28,8 +28,9 @@
// 02 Dec. 1995, G.Cosmo : Structure created based on object model
// 06 Jun. 1996, K.Amako : Implemented the 1st version
// 01 Jul. 1996, K.Amako : Cache mechanism and hidden bin from the
// user introduced.
// 26 Sep. 1996, K.Amako : Constructor with only 'bin size' added.
// user introduced
// 26 Sep. 1996, K.Amako : Constructor with only 'bin size' added
// 11 Nov. 2000, H.Kurashige : Use STL vector for dataVector and binVector
//
//--------------------------------------------------------------------
@@ -37,29 +38,27 @@
#define G4PhysicsFreeVector_h 1
#include "globals.hh"
#include "G4DataVector.hh"
#include "G4PhysicsVector.hh"
#include "G4DataVector.hh"
class G4PhysicsFreeVector : public G4PhysicsVector
{
public:
public: // with description
// Constructors
G4PhysicsFreeVector();
G4PhysicsFreeVector(size_t theNbin);
G4PhysicsFreeVector(const G4DataVector& binVector,
const G4DataVector& dataVector);
// Constructors:
// 'binVector' has the low edge value of each scale bin.
// 'dataVector' has the cross-section/energy-loss/etc at
// the energy/momenturm of the corresponding a bin of
// 'binVector'. 'binVector' and 'dataVector' need to have
// the same vector length.
// Destructor
~G4PhysicsFreeVector();
// Destructor
// Special PutValue function for PhysicsFreeVector
void PutValue( size_t binNumber, G4double binValue,
G4double dataValue );
// To use this method to fill a PhysicsFreeVector, you have
@@ -75,7 +74,8 @@ class G4PhysicsFreeVector : public G4PhysicsVector
};
inline size_t G4PhysicsFreeVector::FindBinLocation(G4double theEnergy) const
inline
size_t G4PhysicsFreeVector::FindBinLocation(G4double theEnergy) const
{
// For G4PhysicsFreeVector, FindBinLocation is implemented using
// the binary search algorithm.
@@ -92,11 +92,11 @@ inline size_t G4PhysicsFreeVector::FindBinLocation(G4double theEnergy) const
while (lowerBound <= upperBound) {
size_t midBin = (lowerBound + upperBound)/2;
if( theEnergy < binVector(midBin) )
if( theEnergy < binVector[midBin] )
upperBound = midBin-1;
else
lowerBound = midBin+1;
}
}
return upperBound;
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4PhysicsLinearVector.hh,v 1.2 1999/11/16 17:40:40 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4PhysicsLinearVector.hh,v 1.6 2001/03/09 12:08:18 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
//--------------------------------------------------------------------
@@ -25,8 +25,9 @@
// 02 Dec. 1995, G.Cosmo : Structure created based on object model
// 03 Mar. 1996, K.Amako : Implemented the 1st version
// 01 Jul. 1996, K.Amako : Cache mechanism and hidden bin from the
// user introduced.
// 26 Sep. 1996, K.Amako : Constructor with only 'bin size' added.
// user introduced
// 26 Sep. 1996, K.Amako : Constructor with only 'bin size' added
// 11 Nov. 2000, H.Kurashige : Use STL vector for dataVector and binVector
//
//--------------------------------------------------------------------
@@ -34,26 +35,30 @@
#define G4PhysicsLinearVector_h 1
#include "globals.hh"
#include "G4DataVector.hh"
#include "G4PhysicsVector.hh"
class G4PhysicsLinearVector : public G4PhysicsVector
{
public:
// Constructors
G4PhysicsLinearVector();
G4PhysicsLinearVector(size_t theNbin);
G4PhysicsLinearVector(G4double theEmin, G4double theEmax, size_t theNbin);
// Constructors
public: // with description
G4PhysicsLinearVector(G4double theEmin, G4double theEmax, size_t theNbin);
// Constructor
// Destructor
~G4PhysicsLinearVector();
// Destructor
G4bool Retrieve(G4std::ifstream& fIn, G4bool ascii);
protected:
size_t FindBinLocation(G4double theEnergy) const;
// Find bin# in which theEnergy belongs - pure virtual function
// Find bin# in which theEnergy belongs - pure virtual function
private:
@@ -62,7 +67,8 @@ class G4PhysicsLinearVector : public G4PhysicsVector
};
inline size_t G4PhysicsLinearVector::FindBinLocation(G4double theEnergy) const
inline
size_t G4PhysicsLinearVector::FindBinLocation(G4double theEnergy) const
{
// For G4PhysicsLinearVector, FindBinLocation is implemented using
// a simple arithmetic calculation.
@@ -78,17 +84,3 @@ inline size_t G4PhysicsLinearVector::FindBinLocation(G4double theEnergy) const
}
#endif
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4PhysicsLnVector.hh,v 1.3 2000/03/23 09:20:09 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4PhysicsLnVector.hh,v 1.7 2001/03/09 12:08:18 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
//--------------------------------------------------------------------
@@ -23,6 +23,7 @@
//
// History:
// 27 Apr. 1999, M.G. Pia: Created, copying from G4PhysicsLogVector
// 11 Nov. 2000, H.Kurashige : Use STL vector for dataVector and binVector
//
//--------------------------------------------------------------------
@@ -30,28 +31,32 @@
#define G4PhysicsLnVector_h 1
#include "globals.hh"
#include "G4DataVector.hh"
#include "G4PhysicsVector.hh"
class G4PhysicsLnVector : public G4PhysicsVector
{
public:
// Constructors
G4PhysicsLnVector();
G4PhysicsLnVector(size_t theNbin);
G4PhysicsLnVector(G4double theEmin, G4double theEmax, size_t theNbin);
// Because of logarithmic scale, note that 'theEmin' has to be
// greater than zero. No protection exists against this error.
// Constructors
public: // with description
G4PhysicsLnVector(G4double theEmin, G4double theEmax, size_t theNbin);
// Because of logarithmic scale, note that 'theEmin' has to be
// greater than zero. No protection exists against this error.
// Destructor
~G4PhysicsLnVector();
// Destructor.
G4bool Retrieve(G4std::ifstream& fIn, G4bool ascii);
// To retrieve persistent data from file stream.
protected:
size_t FindBinLocation(G4double theEnergy) const;
// Find bin# in which theEnergy belongs - pure virtual function
// Find bin# in which theEnergy belongs - pure virtual function.
private:
@@ -61,8 +66,10 @@ class G4PhysicsLnVector : public G4PhysicsVector
};
inline size_t G4PhysicsLnVector::FindBinLocation(G4double theEnergy) const {
inline
size_t G4PhysicsLnVector::FindBinLocation(G4double theEnergy) const
{
// For G4PhysicsLnVector, FindBinLocation is implemented using
// a simple arithmetic calculation.
//
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4PhysicsLogVector.hh,v 1.2 1999/11/16 17:40:41 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4PhysicsLogVector.hh,v 1.6 2001/03/09 12:08:19 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
//--------------------------------------------------------------------
@@ -26,7 +26,8 @@
// 03 Mar. 1996, K.Amako : Implemented the 1st version
// 27 Apr. 1996, K.Amako : Cache mechanism added
// 01 Jul. 1996, K.Amako : Hidden bin from the user introduced
// 26 Sep. 1996, K.Amako : Constructor with only 'bin size' added.
// 26 Sep. 1996, K.Amako : Constructor with only 'bin size' added
// 11 Nov. 2000, H.Kurashige : Use STL vector for dataVector and binVector
//
//--------------------------------------------------------------------
@@ -34,28 +35,33 @@
#define G4PhysicsLogVector_h 1
#include "globals.hh"
#include "G4DataVector.hh"
#include "G4PhysicsVector.hh"
class G4PhysicsLogVector : public G4PhysicsVector
{
public:
// Constructors
G4PhysicsLogVector();
G4PhysicsLogVector(size_t theNbin);
G4PhysicsLogVector(G4double theEmin, G4double theEmax, size_t theNbin);
// Because of logarithmic scale, note that 'theEmin' has to be
// greater than zero. No protection exists against this error.
// Constructors
public: // with description
G4PhysicsLogVector(G4double theEmin, G4double theEmax, size_t theNbin);
// Because of logarithmic scale, note that 'theEmin' has to be
// greater than zero. No protection exists against this error.
// Destructor
~G4PhysicsLogVector();
// Destructor
G4bool Retrieve(G4std::ifstream& fIn, G4bool ascii);
// To retrieve persistent data from file stream.
protected:
size_t FindBinLocation(G4double theEnergy) const;
// Find bin# in which theEnergy belongs - pure virtual function
// Find bin# in which theEnergy belongs - pure virtual function
private:
@@ -65,7 +71,8 @@ class G4PhysicsLogVector : public G4PhysicsVector
};
inline size_t G4PhysicsLogVector::FindBinLocation(G4double theEnergy) const
inline
size_t G4PhysicsLogVector::FindBinLocation(G4double theEnergy) const
{
// For G4PhysicsLogVector, FindBinLocation is implemented using
// a simple arithmetic calculation.
@@ -5,19 +5,20 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4PhysicsOrderedFreeVector.hh,v 1.3 1999/11/16 17:40:41 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4PhysicsOrderedFreeVector.hh,v 1.7 2001/03/09 12:08:19 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
////////////////////////////////////////////////////////////////////////
// PhysicsOrderedFreeVector Class Definition
////////////////////////////////////////////////////////////////////////
//
// File: G4PhysicsOrderedFreeVector.hh
// Version: 1.0
// Created: 1996-08-13
// Author: Juliet Armstrong
// Updated: 1997-03-25 by Peter Gumplinger
// > cosmetics (only)
// 2000-11-11 by H.Kurashige
// > use STL vector for dataVector and binVector
// mail: gum@triumf.ca
//
// Class description:
@@ -39,7 +40,6 @@
// Includes
/////////////
#include "g4rw/tpordvec.h"
#include "G4PhysicsVector.hh"
/////////////////////
@@ -48,7 +48,8 @@
class G4PhysicsOrderedFreeVector : public G4PhysicsVector
{
public:
public: // with description
////////////////////////////////
// Constructors and Destructor
@@ -81,7 +82,7 @@ public:
void DumpValues();
private:
private:
size_t FindBinLocation(G4double theEnergy) const;
@@ -93,3 +94,9 @@ private:
#include "G4PhysicsOrderedFreeVector.icc"
#endif /* G4PhysicsOrderedFreeVector_h */
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4PhysicsOrderedFreeVector.icc,v 1.3 2000/11/20 17:26:46 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4PhysicsOrderedFreeVector.icc,v 1.5 2001/01/09 11:26:59 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
////////////////////////////////////////////////////////////////////////
// PhysicsOrderedFreeVector Class Inline Functions Definitions
@@ -17,6 +17,9 @@
// Author: Juliet Armstrong
// mail: gum@triumf.ca
//
// Updated:
// 2000-11-11 by H.Kurashige
// > use STL vector for dataVector and binVector
////////////////////////////////////////////////////////////////////////
////////////////////
@@ -26,25 +29,25 @@
inline
G4double G4PhysicsOrderedFreeVector::GetMaxValue()
{
return dataVector.last();
return dataVector.back();
}
inline
G4double G4PhysicsOrderedFreeVector::GetMinValue()
{
return dataVector.first();
return dataVector.front();
}
inline
G4double G4PhysicsOrderedFreeVector::GetMaxLowEdgeEnergy()
{
return binVector.last();
return binVector.back();
}
inline
G4double G4PhysicsOrderedFreeVector::GetMinLowEdgeEnergy()
{
return binVector.first();
return binVector.front();
}
inline
@@ -62,7 +65,7 @@ size_t G4PhysicsOrderedFreeVector::FindBinLocation(G4double theEnergy) const
G4int n2 = numberOfBin/2;
G4int n3 = numberOfBin - 1;
while (n1 != n3 - 1) {
if (theEnergy > binVector(n2))
if (theEnergy > binVector[n2])
n1 = n2;
else
n3 = n2;
@@ -5,28 +5,104 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4PhysicsTable.hh,v 1.3 1999/11/16 17:40:42 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4PhysicsTable.hh,v 1.10 2001/04/03 07:26:38 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// ------------------------------------------------------------
// GEANT 4 class header file
//
// History: first implementation, based on object model of
// 2nd December 1995, G.Cosmo
// Class description:
//
// Modified 01 March 1996, K. Amako
// G4PhysicsTable is an utility class for storage of pointers
// to G4PhysicsVector containers. It derives all functionalities
// of STL vector containers with the addition of few methods for
// compatibility with previous implementation based on Rogue-Wave
// pointer collections.
// The constructor given the 'capacity' of the table, pre-allocates
// memory for the specified value by invoking the STL's reserve()
// function, in order to avoid reallocation during insertions.
// ------------------------------------------------------------
//
// History:
// -------
// - First implementation, based on object model of
// 2nd December 1995. G.Cosmo
// - 1st March 1996, modified. K.Amako
// - 24th February 2001, migration to STL vectors. H.Kurashige
// - 9th March 2001, added Store/RetrievePhysicsTable. H.Kurashige
//-------------------------------------
#ifndef G4PhysicsTable_h
#define G4PhysicsTable_h 1
#include "g4rw/tpordvec.h"
#include "g4std/vector"
#include "globals.hh"
#include "G4PhysicsVector.hh"
#include "G4ios.hh"
typedef G4RWTPtrOrderedVector<G4PhysicsVector> G4PhysicsTable;
class G4PhysicsVector;
class G4PhysicsTable : public G4std::vector<G4PhysicsVector*>
{
typedef G4std::vector<G4PhysicsVector*> G4PhysCollection;
public: // with description
G4PhysicsTable();
// Default constructor.
G4PhysicsTable(size_t capacity);
// Constructor with capacity. Reserves memory for the
// specified capacity.
virtual ~G4PhysicsTable();
// Destructor.
// Does not invoke deletion of contained pointed collections.
G4PhysicsVector*& operator()(size_t);
G4PhysicsVector* const& operator()(size_t) const;
// Access operators.
void clearAndDestroy();
// Removes all items and deletes them at the same time.
void insert (G4PhysicsVector*);
// Pushes new element to collection.
void insertAt (size_t, G4PhysicsVector*);
// Inserts element at the specified position in the collection.
size_t entries() const;
size_t length() const;
// Return collection's size.
G4bool isEmpty() const;
// Flags if collection is empty or not.
G4bool StorePhysicsTable(const G4String& filename, G4bool ascii=false);
// Stores PhysicsTable in a file (returns false in case of failure).
G4bool RetrievePhysicsTable(const G4String& filename, G4bool ascii=false);
// Retrieves Physics from a file (returns false in case of failure).
friend G4std::ostream& operator<<(G4std::ostream& out, G4PhysicsTable& table);
protected:
G4PhysicsVector* CreatePhysicsVector(G4int type);
private:
G4PhysicsTable(const G4PhysicsTable&);
G4PhysicsTable& operator=(const G4PhysicsTable&);
// Private copy constructor and assignment operator.
};
typedef G4PhysicsTable::iterator G4PhysicsTableIterator;
#include "G4PhysicsVector.hh"
#include "G4PhysicsTable.icc"
#endif
@@ -0,0 +1,73 @@
// 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: G4PhysicsTable.icc,v 1.3 2001/04/03 07:26:38 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// ------------------------------------------------------------
// GEANT 4 class inline implementation
//
// History: first implementation, based on object model of
// 2nd December 1995, G.Cosmo
//
// ------------------------------------------------------------
inline
void G4PhysicsTable::clearAndDestroy()
{
G4PhysicsVector* a;
while (size()>0) {
a = back();
pop_back();
if ( a ) delete a;
}
}
inline
G4PhysicsVector*& G4PhysicsTable::operator()(size_t i)
{
return (*this)[i];
}
inline
G4PhysicsVector* const& G4PhysicsTable::operator()(size_t i) const
{
return (*this)[i];
}
inline
void G4PhysicsTable::insert(G4PhysicsVector* pvec)
{
push_back(pvec);
}
inline
void G4PhysicsTable::insertAt (size_t idx, G4PhysicsVector* pvec)
{
G4PhysicsTableIterator itr=begin();
for (size_t i=0; i<idx; ++i) itr++;
G4PhysCollection::insert(itr, pvec);
}
inline
size_t G4PhysicsTable::entries() const
{
return size();
}
inline
size_t G4PhysicsTable::length() const
{
return size();
}
inline
G4bool G4PhysicsTable::isEmpty() const
{
return empty();
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4PhysicsVector.hh,v 1.4 2000/11/20 17:26:46 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4PhysicsVector.hh,v 1.9 2001/03/09 12:08:19 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
//---------------------------------------------------------------
@@ -26,47 +26,59 @@
// 02 Dec. 1995, G.Cosmo : Structure created based on object model
// 03 Mar. 1996, K.Amako : Implemented the 1st version
// 27 Apr. 1996, K.Amako : Cache mechanism added
// 01 Jul. 1996, K.Amako : Now GetValue not virtual.
// 21 Sep. 1996, K.Amako : Added [] and () operators.
// 01 Jul. 1996, K.Amako : Now GetValue not virtual
// 21 Sep. 1996, K.Amako : Added [] and () operators
// 11 Nov. 2000, H.Kurashige : use STL vector for dataVector and binVector
// 18 Jan. 2001, H.Kurashige : removed ptrNextTable
// 09 Mar. 2001, H.Kurashige : added G4PhysicsVectorType & Store/Retrieve()
//
//---------------------------------------------------------------
#ifndef G4PhysicsVector_h
#define G4PhysicsVector_h 1
#include "g4std/vector"
#include "globals.hh"
#include "G4DataVector.hh"
#include "g4rw/tpordvec.h"
#include "G4ios.hh"
#include "g4std/iostream"
#include "g4std/fstream"
#include "G4PhysicsVectorType.hh"
class G4PhysicsVector
{
public:
public:
// Constructor and destructor
G4PhysicsVector();
virtual ~G4PhysicsVector();
// constructor
// This class is an abstract class with pure virtual method of
// virtual size_t FindBinLocation(G4double theEnergy) const
// So, default constructor is not supposed to be invoked explicitly
// Public functions
G4double GetValue(G4double theEnergy, G4bool& isOutRange);
// Get the crosssection/energy-loss value corresponding to the
public: // with description
virtual ~G4PhysicsVector();
// destructor
inline G4double GetValue(G4double theEnergy, G4bool& isOutRange);
// Get the cross-section/energy-loss value corresponding to the
// given energy. An appropriate interpolation is used to calculate
// the value.
// [Note] isOutRange is not used anymore. This argument is kept
// for the compatibility reason.
// Public operators
G4int operator==(const G4PhysicsVector &right) const ;
G4int operator!=(const G4PhysicsVector &right) const ;
G4double operator[](const size_t binNumber) const ;
inline G4double operator[](const size_t binNumber) const ;
// Returns simply the value in the bin specified by 'binNumber'
// of the dataVector. The boundary check will be Done. If you
// don't want this check, use the operator ().
G4double operator()(const size_t binNumber) const ;
inline G4double operator()(const size_t binNumber) const ;
// Returns simply the value in the bin specified by 'binNumber'
// of the dataVector. The boundary check will not be Done. If
// you want this check, use the operator [].
// Public functions
void PutValue(size_t binNumber, G4double theValue);
inline void PutValue(size_t binNumber, G4double theValue);
// Put 'theValue' into the bin specified by 'binNumber'.
// Take note that the 'binNumber' starts from '0'.
// To fill the vector, you have beforehand to Construct a vector
@@ -80,28 +92,32 @@ class G4PhysicsVector
// This value is defined when a physics vector is constructed
// by a constructor of a derived class. Use this function
// when you fill physis vector by PutValue().
size_t GetVectorLength() const;
inline size_t GetVectorLength() const;
// Get the toal length (bin number) of the vector.
G4bool IsFilledVectorExist() const;
inline G4bool IsFilledVectorExist() const;
// Is non-empty physics vector already exist?
void LinkPhysicsTable(G4RWTPtrOrderedVector<G4PhysicsVector>& theTable);
// Link the given G4PhysicsTable to the current G4PhyiscsVector.
G4bool IsLinkedTableExist() const;
// Has this physics vector an extended physics table?
const G4RWTPtrOrderedVector<G4PhysicsVector>* GetNextTable() const;
// Returns the pointer to a physics table created for elements
// or isotopes (when the cross-sesctions or energy-losses
// depend explicitly on them).
void PutComment(const G4String& theComment);
inline void PutComment(const G4String& theComment);
// Put a comment to the G4PhysicsVector. This may help to check
// whether your are accessing to the one you want.
G4String GetComment() const;
inline const G4String& GetComment() const;
// Retrieve the comment of the G4PhysicsVector.
inline G4PhysicsVectorType GetType() const;
// Get physics vector type
virtual G4bool Store(G4std::ofstream& fOut, G4bool ascii=false);
virtual G4bool Retrieve(G4std::ifstream& fIn, G4bool ascii=false);
// To store/retrieve persistent data to/from file streams.
friend G4std::ostream& operator<<(G4std::ostream&, const G4PhysicsVector&);
protected:
typedef G4std::vector<G4double> G4PVDataVector;
G4PhysicsVectorType type; // The type of PhysicsVector (enumerator)
G4double edgeMin; // Lower edge value of the lowest bin
G4double edgeMax; // Lower edge value of the highest bin
size_t numberOfBin;
@@ -110,22 +126,20 @@ class G4PhysicsVector
G4double lastValue; // Cache the last output value
size_t lastBin; // Cache the last bin location
G4DataVector dataVector; // Vector to keep the crossection/energyloss
G4DataVector binVector; // Vector to keep the low edge value of bin
G4PVDataVector dataVector; // Vector to keep the crossection/energyloss
G4PVDataVector binVector; // Vector to keep the low edge value of bin
G4RWTPtrOrderedVector<G4PhysicsVector>* ptrNextTable;
// Link to the connected physics table
G4double LinearInterpolation(G4double theEnergy, size_t theLocBin);
inline G4double LinearInterpolation(G4double theEnergy, size_t theLocBin);
// Linear interpolation function
virtual size_t FindBinLocation(G4double theEnergy) const=0;
// Find the bin# in which theEnergy belongs - pure virtual function
private:
protected:
G4PhysicsVector(const G4PhysicsVector&);
G4PhysicsVector& operator=(const G4PhysicsVector&);
// Private copy constructor and assignment operator.
// Protected copy constructor and assignment operator.
private:
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4PhysicsVector.icc,v 1.1 1999/11/16 17:40:46 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4PhysicsVector.icc,v 1.6 2001/03/09 12:08:19 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
//---------------------------------------------------------------
@@ -24,27 +24,32 @@
//---------------------------------------------------------------
inline G4double G4PhysicsVector::operator[](const size_t binNumber) const
inline
G4double G4PhysicsVector::operator[](const size_t binNumber) const
{
return dataVector[binNumber];
}
inline G4double G4PhysicsVector::operator()(const size_t binNumber) const
inline
G4double G4PhysicsVector::operator()(const size_t binNumber) const
{
return dataVector(binNumber);
return dataVector[binNumber];
}
inline const G4RWTPtrOrderedVector<G4PhysicsVector>*
G4PhysicsVector::GetNextTable() const
inline
size_t G4PhysicsVector::GetVectorLength() const
{
return ptrNextTable;
return numberOfBin;
}
inline G4double G4PhysicsVector::LinearInterpolation(G4double theEnergy,
size_t theLocBin) {
inline
G4double G4PhysicsVector::LinearInterpolation(G4double theEnergy,
size_t theLocBin)
{
// Linear interpolation is used to get the value. If the give energy
// is in the highest bin, no interpolation will be Done. Because
@@ -52,16 +57,18 @@ inline G4double G4PhysicsVector::LinearInterpolation(G4double theEnergy,
// the following interpolation is valid even the current locBin=
// numberOfBin-1.
G4double intplFactor = (theEnergy-binVector(theLocBin))
/ (binVector(theLocBin+1)-binVector(theLocBin)); // Interpolation factor
G4double intplFactor = (theEnergy-binVector[theLocBin])
/ (binVector[theLocBin+1]-binVector[theLocBin]); // Interpolation factor
return dataVector(theLocBin) +
( dataVector(theLocBin+1)-dataVector(theLocBin) ) * intplFactor;
return dataVector[theLocBin] +
( dataVector[theLocBin+1]-dataVector[theLocBin] ) * intplFactor;
}
inline G4double G4PhysicsVector::GetValue(G4double theEnergy,
G4bool& isOutRange) {
inline
G4double G4PhysicsVector::GetValue(G4double theEnergy,
G4bool& isOutRange)
{
// Use cache for speed up - check if the value 'theEnergy' is same as the
// last call. If it is same, then use the last bin location. Also the
@@ -74,28 +81,28 @@ inline G4double G4PhysicsVector::GetValue(G4double theEnergy,
if( theEnergy == lastEnergy ) {
return lastValue;
}
else if( (theEnergy < lastEnergy) &&
(theEnergy >= binVector(lastBin)) ) {
} else if( (theEnergy < lastEnergy) &&
(theEnergy >= binVector[lastBin]) ) {
locBin = lastBin;
lastEnergy = theEnergy;
lastValue = LinearInterpolation(theEnergy, locBin);
return lastValue;
}
else if( theEnergy < edgeMin ){
} else if( theEnergy < edgeMin ){
lastBin = 0;
lastEnergy = theEnergy;
lastValue = dataVector(0);
lastValue = dataVector[0];
return lastValue;
}
else if( theEnergy >= edgeMax ){
} else if( theEnergy >= edgeMax ){
lastBin = numberOfBin-1;
lastEnergy = theEnergy;
lastValue = dataVector( numberOfBin-1 );
lastValue = dataVector[ numberOfBin-1 ];
return lastValue;
}
else {
} else {
locBin = FindBinLocation(theEnergy);
lastBin = locBin;
@@ -103,4 +110,45 @@ inline G4double G4PhysicsVector::GetValue(G4double theEnergy,
lastValue = LinearInterpolation(theEnergy, locBin);
return lastValue;
}
}
inline
void G4PhysicsVector::PutValue(size_t binNumber, G4double theValue)
{
dataVector[binNumber] = 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) {
dataVector[binNumber+1] = theValue;
}
}
inline
G4bool G4PhysicsVector::IsFilledVectorExist() const
{
G4bool status=false;
if(numberOfBin > 0) status=true;
return status;
}
inline
void G4PhysicsVector::PutComment(const G4String& theComment)
{
comment = theComment;
}
inline
const G4String& G4PhysicsVector::GetComment() const
{
return comment;
}
inline
G4PhysicsVectorType G4PhysicsVector::GetType() const
{
return type;
}
@@ -0,0 +1,42 @@
// 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: G4PhysicsVectorType.hh,v 1.2 2001/03/09 12:08:20 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
// --------------------------------------------------------------
//
// G4PhysicsVectorType
//
// Class Description:
//
// Enumerator to define the physics vector type:
// G4PhysicsVector - base
// G4PhysicsLinearVector
// G4PhysicsLogVector
// G4PhysicsLnVector
// G4PhysicsFreeVector
// G4PhysicsOrderedFreeVector
// G4LPhysicsFreeVector
// --------------------------------------------------------------
#ifndef G4PhysicsVectorType_h
#define G4PhysicsVectorType_h
enum G4PhysicsVectorType
{
T_G4PhysicsVector =0,
T_G4PhysicsLinearVector,
T_G4PhysicsLogVector,
T_G4PhysicsLnVector,
T_G4PhysicsFreeVector,
T_G4PhysicsOrderedFreeVector,
T_G4LPhysicsFreeVector
};
#endif
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4RotationMatrix.hh,v 1.2 1999/11/16 17:40:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// ----------------------------------------------------------------------
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4UnitsTest.hh,v 1.4 1999/11/19 09:19:30 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4SIunits.hh,v 1.1 2001/03/02 11:01:51 maire Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
// ----------------------------------------------------------------------
//
@@ -42,7 +42,8 @@
//
// History:
//
// 10.03.99 created
// 10.03.99 created
// 01.03.01 parsec
#ifndef G4UNITSTEST_HH
#define G4UNITSTEST_HH
@@ -68,6 +69,8 @@ static const HepDouble kilometer = 1000.*meter;
static const HepDouble kilometer2 = kilometer*kilometer;
static const HepDouble kilometer3 = kilometer*kilometer*kilometer;
static const HepDouble parsec = 3.0856775807e+16*meter;
static const HepDouble micrometer = 1.e-6 *meter;
static const HepDouble nanometer = 1.e-9 *meter;
static const HepDouble angstrom = 1.e-10*meter;
@@ -96,6 +99,8 @@ static const HepDouble km = kilometer;
static const HepDouble km2 = kilometer2;
static const HepDouble km3 = kilometer3;
static const HepDouble pc = parsec;
//
// Angle
//
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4StateManager.hh,v 1.2 2000/11/20 17:26:46 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4StateManager.hh,v 1.3 2001/03/06 15:56:48 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// ------------------------------------------------------------
@@ -35,7 +35,7 @@
#ifndef G4StateManager_h
#define G4StateManager_h 1
#include "g4rw/tpordvec.h"
#include "g4std/vector"
#include "globals.hh"
#include "G4ApplicationState.hh"
#include "G4VStateDependent.hh"
@@ -60,9 +60,9 @@ public:
public: // with description
G4ApplicationState GetCurrentState();
G4ApplicationState GetCurrentState() const;
// Returns the current state
G4ApplicationState GetPreviousState();
G4ApplicationState GetPreviousState() const;
// Returns the previous state
G4bool SetNewState(G4ApplicationState requestedState);
// Set Geant4 to a new state.
@@ -79,7 +79,7 @@ public: // with description
G4VStateDependent* RemoveDependent(const G4VStateDependent* aDependent);
// Remove the registration.
// Removed pointer is returned.
G4String GetStateString(G4ApplicationState aState);
G4String GetStateString(G4ApplicationState aState) const;
// Utility method which returns a string of the state name.
public:
@@ -104,7 +104,7 @@ private:
static G4StateManager* theStateManager;
G4ApplicationState theCurrentState;
G4ApplicationState thePreviousState;
G4RWTPtrOrderedVector<G4VStateDependent> theDependentsList;
G4std::vector<G4VStateDependent*> theDependentsList;
G4VStateDependent* theBottomDependent;
};
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4ThreeVector.hh,v 1.2 1999/11/16 17:40:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// ----------------------------------------------------------------------
+1 -1
View File
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4Timer.hh,v 1.10 2000/01/06 14:27:09 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// ----------------------------------------------------------------------
+1 -1
View File
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4Types.hh,v 1.4 1999/12/15 18:05:19 gracia Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// GEANT4 native types
@@ -5,26 +5,26 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4UnitsTable.hh,v 1.9 2000/01/19 11:16:46 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4UnitsTable.hh,v 1.10 2001/03/06 15:56:48 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// -----------------------------------------------------------------
// GEANT 4 class header file
//
// ------------------- class G4UnitsTable -----------------
//
// 17-05-98: first version, M.Maire
// 13-10-98: Units and symbols printed in fixed length
// 18-01-00: BestUnit for three vector
// 13-10-98: Units and symbols printed in fixed length, M.Maire
// 18-01-00: BestUnit for three vector, M.Maire
// 06-03-01: Migrated to STL vectors, G.Cosmo
//
// Class description:
//
// This class maintains a table of Units.
// A Unit has a name, a symbol, a value and belong to a category (i.e. its
// dimensional definition): Length, Time, Energy, etc...
// The Units are grouped by category. The TableOfUnits is a list of categories.
// The class BestUnit allow to convert automaticaly a physical quantity
// The class G4BestUnit allows to convert automaticaly a physical quantity
// from its internal value into the most appropriate Unit of the same category.
//
@@ -35,11 +35,11 @@
#define G4UnitsTable_HH
#include "globals.hh"
#include "g4rw/tpordvec.h"
#include "g4std/vector"
#include "G4ThreeVector.hh"
class G4UnitsCategory;
typedef G4RWTPtrOrderedVector<G4UnitsCategory> G4UnitsTable;
typedef G4std::vector<G4UnitsCategory*> G4UnitsTable;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -48,8 +48,8 @@ class G4UnitDefinition
{
public: // with description
G4UnitDefinition(G4String name, G4String symbol,G4String category,
G4double value);
G4UnitDefinition(G4String name, G4String symbol,
G4String category, G4double value);
public: // without description
@@ -64,18 +64,17 @@ private:
public: // with description
G4String GetName() {return Name;};
G4String GetSymbol() {return SymbolName;};
G4double GetValue() {return Value;};
G4String GetName() const {return Name;}
G4String GetSymbol() const {return SymbolName;}
G4double GetValue() const {return Value;}
void PrintDefinition();
static void BuildUnitsTable();
static void PrintUnitsTable();
static
G4UnitsTable& GetUnitsTable() {return theUnitsTable;};
static G4UnitsTable& GetUnitsTable() {return theUnitsTable;}
static G4double GetValueOf (G4String);
static G4String GetCategory(G4String);
@@ -94,7 +93,7 @@ private:
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
typedef G4RWTPtrOrderedVector<G4UnitDefinition> G4UnitsContainer;
typedef G4std::vector<G4UnitDefinition*> G4UnitsContainer;
class G4UnitsCategory
{
@@ -112,13 +111,13 @@ private:
public: // without description
G4String GetName() {return Name;};
G4UnitsContainer& GetUnitsList() {return UnitsList;};
G4int GetNameMxLen() {return NameMxLen;};
G4int GetSymbMxLen() {return SymbMxLen;};
void UpdateNameMxLen(G4int len) {if (NameMxLen<len) NameMxLen=len;};
void UpdateSymbMxLen(G4int len) {if (SymbMxLen<len) SymbMxLen=len;};
void PrintCategory();
G4String GetName() const {return Name;}
G4UnitsContainer& GetUnitsList() {return UnitsList;}
G4int GetNameMxLen() const {return NameMxLen;}
G4int GetSymbMxLen() const {return SymbMxLen;}
void UpdateNameMxLen(G4int len) {if (NameMxLen<len) NameMxLen=len;}
void UpdateSymbMxLen(G4int len) {if (SymbMxLen<len) SymbMxLen=len;}
void PrintCategory();
private:
@@ -134,25 +133,25 @@ class G4BestUnit
{
public: // with description
G4BestUnit(G4double internalValue, G4String category);
G4BestUnit(G4double internalValue, G4String category);
G4BestUnit(const G4ThreeVector& internalValue, G4String category);
// These constructors convert a physical quantity from its internalValue
// into the most appropriate unit of the same category.
// In practice it builds an object VU = (newValue, newUnit)
// These constructors convert a physical quantity from its internalValue
// into the most appropriate unit of the same category.
// In practice it builds an object VU = (newValue, newUnit)
~G4BestUnit();
public: // without description
G4double* GetValue() {return Value;};
G4String GetCategory() {return Category;};
size_t GetIndexOfCategory() {return IndexOfCategory;};
G4double* GetValue() {return Value;}
G4String GetCategory() const {return Category;}
size_t GetIndexOfCategory() const {return IndexOfCategory;}
public: // with description
friend
G4std::ostream& operator<<(G4std::ostream&,G4BestUnit VU);
// Default format to print the objet VU above.
// Default format to print the objet VU above.
private:
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4UserLimits.hh,v 1.6 2000/02/17 16:13:06 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// class G4UserLimits
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4UserLimits.icc,v 1.5 2000/02/17 16:13:08 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
//
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4VStateDependent.hh,v 1.2 2000/11/20 17:26:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// ------------------------------------------------------------
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4coutDestination.hh,v 1.3 2000/11/20 17:26:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// ---------------------------------------------------------------
+1 -1
View File
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4ios.hh,v 1.5 1999/12/15 18:05:18 gracia Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// ---------------------------------------------------------------
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4strstreambuf.hh,v 1.7 2000/11/20 17:26:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// ---------------------------------------------------------------
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4strstreambuf.icc,v 1.1 2000/11/20 17:26:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// ---------------------------------------------------------------
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: PhysicalConstants.h,v 1.4 1999/11/19 09:19:31 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: PhysicalConstants.h,v 1.5 2001/03/02 11:28:29 maire Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
// ----------------------------------------------------------------------
//
@@ -50,7 +50,7 @@
#define HEP_PHYSICAL_CONSTANTS_H
#include "SystemOfUnits.h"
///#include "G4UnitsTest.hh"
////#include "G4SIunits.hh"
//
//
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: SystemOfUnits.h,v 1.4 1999/11/19 09:19:31 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: SystemOfUnits.h,v 1.6 2001/03/05 13:25:22 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
// ----------------------------------------------------------------------
//
@@ -27,7 +27,7 @@
// radian (radian)
// steradian (steradian)
//
// Below is a non exhaustive List of derived and pratical units
// Below is a non exhaustive list of derived and pratical units
// (i.e. mostly the SI units).
// You can add your own units.
//
@@ -45,9 +45,10 @@
// 06.02.96 Created.
// 28.03.96 Added miscellaneous constants.
// 05.12.97 E.Tcherniaev: Redefined pascal (to avoid warnings on WinNT)
// 20.05.98 names: meter, second, gram, radian, degree. (from Blasiuk (STAR))
// Added luminous units.
// 05.08.98 angstrom,picobarn,microsecond,picosecond,petaelectronvolt
// 20.05.98 names: meter, second, gram, radian, degree
// (from Brian.Lasiuk@yale.edu (STAR)). Added luminous units.
// 05.08.98 angstrom, picobarn, microsecond, picosecond, petaelectronvolt
// 01.03.01 parsec
#ifndef HEP_SYSTEM_OF_UNITS_H
#define HEP_SYSTEM_OF_UNITS_H
@@ -73,6 +74,8 @@ static const HepDouble kilometer = 1000.*meter;
static const HepDouble kilometer2 = kilometer*kilometer;
static const HepDouble kilometer3 = kilometer*kilometer*kilometer;
static const HepDouble parsec = 3.0856775807e+16*meter;
static const HepDouble micrometer = 1.e-6 *meter;
static const HepDouble nanometer = 1.e-9 *meter;
static const HepDouble angstrom = 1.e-10*meter;
@@ -101,6 +104,8 @@ static const HepDouble km = kilometer;
static const HepDouble km2 = kilometer2;
static const HepDouble km3 = kilometer3;
static const HepDouble pc = parsec;
//
// Angle
//
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: algorithm,v 1.3 1999/11/16 17:42:57 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
// ---------------- algorithm ----------------
//
@@ -7,7 +7,7 @@
//
//
// $Id: complex,v 1.3 2000/06/15 17:32:10 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
// ---------------- complex ----------------
//
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: fstream,v 1.3 1999/11/16 17:43:06 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
// ---------------- fstream ----------------
//
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: functional,v 1.3 1999/11/16 17:43:06 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
// ---------------- functional ----------------
//
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: iomanip,v 1.3 1999/11/16 17:43:08 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
// ---------------- iomanip ----------------
//
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: iostream,v 1.3 1999/11/16 17:43:08 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
// ---------------- iostream ----------------
//
+1 -1
View File
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: list,v 1.1 2000/08/22 07:54:26 hpw Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
// ---------------- list ----------------
//
+1 -1
View File
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: map,v 1.3 1999/11/16 17:43:08 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
// ---------------- map ----------------
//
+1 -1
View File
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: queue,v 1.1 2000/08/02 09:49:56 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
// ---------------- queue ----------------
//
+1 -1
View File
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: set,v 1.3 1999/11/16 17:43:08 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
// ---------------- set ----------------
//
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: streambuf,v 1.3 1999/11/16 17:43:09 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
// ---------------- streambuf ----------------
//
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: strstream,v 1.3 1999/11/16 17:43:09 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
// ---------------- strstream ----------------
//
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: vector,v 1.3 1999/11/16 17:43:09 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
// ---------------- vector ----------------
//
+1 -1
View File
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: globals.hh,v 1.15 2000/01/19 11:12:44 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// Global Constants and typedefs
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: templates.hh,v 1.5 2000/01/03 11:39:39 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// -*- C++ -*-
+1 -1
View File
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4Exception.cc,v 1.9 2000/07/22 10:45:35 asaim Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// ----------------------------------------------------------------------
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4LPhysicsFreeVector.cc,v 1.3 2000/11/20 17:26:48 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4LPhysicsFreeVector.cc,v 1.7 2001/03/09 03:39:30 kurasige Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// --------------------------------------------------------------------
@@ -17,6 +17,7 @@
// F.W. Jones, TRIUMF, 04-JUN-96
//
// 27-MAR-97 FWJ: first version for Alpha release
// 11-NOV-00 H.Kurashige : use STL vector for dataVector and binVector
//
#include "G4LPhysicsFreeVector.hh"
@@ -25,7 +26,8 @@
G4LPhysicsFreeVector::G4LPhysicsFreeVector()
{
ptrNextTable = 0;
type = T_G4LPhysicsFreeVector;
edgeMin = 0.0;
edgeMax = 0.0;
numberOfBin = 0;
@@ -35,16 +37,21 @@ G4LPhysicsFreeVector::G4LPhysicsFreeVector()
G4LPhysicsFreeVector::G4LPhysicsFreeVector(size_t nbin, G4double binmin,
G4double binmax)
{
type = T_G4LPhysicsFreeVector;
edgeMin = binmin;
edgeMax = binmax;
numberOfBin = nbin;
lastEnergy = 0.;
lastValue = 0.;
lastBin = 0;
binVector.resize(nbin);
dataVector.resize(nbin);
ptrNextTable = 0;
binVector.reserve(nbin);
dataVector.reserve(nbin);
verboseLevel = 0;
for (size_t i=0; i<numberOfBin; i++) {
binVector.push_back(0.0);
dataVector.push_back(0.0);
}
}
G4LPhysicsFreeVector::~G4LPhysicsFreeVector()
@@ -54,7 +61,7 @@ G4LPhysicsFreeVector::~G4LPhysicsFreeVector()
void G4LPhysicsFreeVector::DumpValues()
{
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);
// 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.3 2000/11/20 17:26:48 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4PhysicsFreeVector.cc,v 1.7 2001/03/09 03:39:30 kurasige Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
//--------------------------------------------------------------------
@@ -16,10 +16,11 @@
//
// History:
// 02 Dec. 1995, G.Cosmo : Structure created based on object model
// 06 June 1996, K.Amako : The 1st version of implemented.
// 06 June 1996, K.Amako : The 1st version of implemented
// 01 Jul. 1996, K.Amako : Cache mechanism and hidden bin from the
// user introduced.
// 26 Sep. 1996, K.Amako : Constructor with only 'bin size' added.
// user introduced
// 26 Sep. 1996, K.Amako : Constructor with only 'bin size' added
// 11 Nov. 2000, H.Kurashige : use STL vector for dataVector and binVector
//
//--------------------------------------------------------------------
@@ -28,23 +29,27 @@
G4PhysicsFreeVector::G4PhysicsFreeVector()
{
ptrNextTable = 0;
edgeMin = 0.0;
edgeMax = 0.0;
numberOfBin = 0;
type = T_G4PhysicsFreeVector;
}
G4PhysicsFreeVector::G4PhysicsFreeVector(size_t theNbin)
{
type = T_G4PhysicsFreeVector;
numberOfBin = theNbin;
// Add extra one bin (hidden to user) to handle correctly when
// Energy=theEmax in getValue.
dataVector.resize(numberOfBin+1);
binVector.resize(numberOfBin+1);
dataVector.reserve(numberOfBin+1);
binVector.reserve(numberOfBin+1);
ptrNextTable = 0;
for (size_t i=0; i<=numberOfBin; i++) {
binVector.push_back(0.0);
dataVector.push_back(0.0);
}
edgeMin = 0.;
edgeMax = 0.;
@@ -59,33 +64,32 @@ G4PhysicsFreeVector::G4PhysicsFreeVector(size_t theNbin)
G4PhysicsFreeVector::G4PhysicsFreeVector(const G4DataVector& theBinVector,
const G4DataVector& theDataVector)
{
numberOfBin = theBinVector.entries();
type = T_G4PhysicsFreeVector;
numberOfBin = theBinVector.size();
// Add extra one bin (hidden to user) to handle correctly when
// Energy=theEmax in getValue.
dataVector.resize(numberOfBin+1);
binVector.resize(numberOfBin+1);
ptrNextTable = 0;
dataVector.reserve(numberOfBin+1);
binVector.reserve(numberOfBin+1);
for (size_t i=0; i<numberOfBin; i++) {
binVector(i) = theBinVector(i);
dataVector(i) = theDataVector(i);
binVector.push_back(theBinVector[i]);
dataVector.push_back(theDataVector[i]);
}
// Put values to extra hidden bin. For 'binVector', the 'edgeMin' of the
// extra hidden bin is assumed to have the following value. For binary
// search, this value is completely arbitrary if it is greater than
// the 'edgeMin' at 'numberOfBin-1'.
binVector(numberOfBin) = theBinVector(numberOfBin-1) + 1.0;
binVector.push_back ( theBinVector[numberOfBin-1] + 1.0 );
// Put values to extra hidden bin. For 'dataVector', the 'value' of the
// extra hidden bin is assumed to have the same as the one at 'numberBin-1'.
dataVector(numberOfBin) = theDataVector(numberOfBin-1);
dataVector.push_back( theDataVector[numberOfBin-1] );
edgeMin = binVector(0);
edgeMax = binVector(numberOfBin-1);
edgeMin = binVector[0];
edgeMax = binVector[numberOfBin-1];
lastBin = INT_MAX;
lastEnergy = -DBL_MAX;
@@ -100,26 +104,26 @@ G4PhysicsFreeVector::~G4PhysicsFreeVector(){}
void G4PhysicsFreeVector::PutValue( size_t theBinNumber, G4double theBinValue,
G4double theDataValue )
{
binVector(theBinNumber) = theBinValue;
dataVector(theBinNumber) = theDataValue;
binVector[theBinNumber] = theBinValue;
dataVector[theBinNumber] = theDataValue;
if( theBinNumber == numberOfBin-1 ) {
edgeMax = binVector(numberOfBin-1);
edgeMax = binVector[numberOfBin-1];
// Put values to extra hidden bin. For 'binVector', the 'edgeMin'
// of the extra hidden bin is assumed to have the following value.
// For binary search, this value is completely arbitrary if it is
// greater than the 'edgeMin' at 'numberOfBin-1'.
binVector(numberOfBin) = theBinValue + 1.0;
binVector[numberOfBin] = theBinValue + 1.0;
// Put values to extra hidden bin. For 'dataVector', the 'value'
// of the extra hidden bin is assumed to have the same as the one
// at 'numberBin-1'.
dataVector(numberOfBin) = theDataValue;
dataVector[numberOfBin] = theDataValue;
}
if( theBinNumber == 0 ) {
edgeMin = binVector(0);
edgeMin = binVector[0];
}
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4PhysicsLinearVector.cc,v 1.3 2000/11/20 17:26:48 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4PhysicsLinearVector.cc,v 1.8 2001/04/03 09:15:24 kurasige Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
//--------------------------------------------------------------------
@@ -14,12 +14,14 @@
//
// G4PhysicsLinearVector.cc
//
// History: first implementation, based on object model of
// History:
// 02 Dec. 1995, G.Cosmo : Structure created based on object model
// 15 Feb. 1996, K.Amako : Implemented the 1st version
// 01 Jul. 1996, K.Amako : Cache mechanism and hidden bin from the
// user introduced.
// 26 Sep. 1996, K.Amako : Constructor with only 'bin size' added.
// 11 Nov. 2000, H.Kurashige : use STL vector for dataVector and binVector
// 9 Mar. 2001, H.Kurashige : add PhysicsVector type and Retrieve
//
//--------------------------------------------------------------------
@@ -27,21 +29,21 @@
G4PhysicsLinearVector::G4PhysicsLinearVector()
{
ptrNextTable = 0;
edgeMin = 0.0;
edgeMax = 0.0;
numberOfBin = 0;
type = T_G4PhysicsLinearVector;
}
G4PhysicsLinearVector::G4PhysicsLinearVector(size_t theNbin)
{
type = T_G4PhysicsLinearVector;
// Add extra one bin (hidden to user) to handle correctly when
// Energy=theEmax in getValue.
dataVector.resize(theNbin+1);
binVector.resize(theNbin+1);
dataVector.reserve(theNbin+1);
binVector.reserve(theNbin+1);
ptrNextTable = 0;
numberOfBin = theNbin;
dBin = 0.;
baseBin = 0.;
@@ -52,28 +54,34 @@ G4PhysicsLinearVector::G4PhysicsLinearVector(size_t theNbin)
lastBin = INT_MAX;
lastEnergy = -DBL_MAX;
lastValue = DBL_MAX;
for (size_t i=0; i<=numberOfBin; i++) {
binVector.push_back(0.0);
dataVector.push_back(0.0);
}
}
G4PhysicsLinearVector::G4PhysicsLinearVector(G4double theEmin,
G4double theEmax, size_t theNbin)
{
type = T_G4PhysicsLinearVector;
// Add extra one bin (hidden to user) to handle correctly when
// Energy=theEmax in getValue.
dataVector.resize(theNbin+1);
binVector.resize(theNbin+1);
dataVector.reserve(theNbin+1);
binVector.reserve(theNbin+1);
ptrNextTable = 0;
numberOfBin = theNbin;
dBin = (theEmax-theEmin) / numberOfBin;
baseBin = theEmin/dBin;
for (size_t i=0; i<numberOfBin+1; i++) {
binVector(i) = theEmin + i*dBin;
binVector.push_back( theEmin + i*dBin );
dataVector.push_back(0.0);
}
edgeMin = binVector(0);
edgeMax = binVector(numberOfBin-1);
edgeMin = binVector[0];
edgeMax = binVector[numberOfBin-1];
lastBin = INT_MAX;
lastEnergy = -DBL_MAX;
@@ -81,3 +89,16 @@ G4PhysicsLinearVector::G4PhysicsLinearVector(G4double theEmin,
}
G4PhysicsLinearVector::~G4PhysicsLinearVector(){}
G4bool G4PhysicsLinearVector::Retrieve(G4std::ifstream& fIn, G4bool ascii)
{
G4bool success = G4PhysicsVector::Retrieve(fIn, ascii);
if (success){
G4double theEmin = binVector[0];
dBin = binVector[1]-theEmin;
baseBin = theEmin/dBin;
}
return success;
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4PhysicsLnVector.cc,v 1.4 2000/11/20 17:26:48 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4PhysicsLnVector.cc,v 1.10 2001/04/03 09:15:24 kurasige Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// --------------------------------------------------------------
@@ -16,26 +16,29 @@
//
// History:
// 27 Apr. 1999, M.G. Pia: Created, copying from G4PhysicsLogVector
// 11 Nov. 2000, H.Kurashige : use STL vector for dataVector and binVector
// 9 Mar. 2001, H.Kurashige : add PhysicsVector type and Retrieve
//
// --------------------------------------------------------------
#include "G4PhysicsLnVector.hh"
G4PhysicsLnVector::G4PhysicsLnVector()
: dBin(0.), baseBin(0.)
{}
{
type = T_G4PhysicsLnVector;
}
G4PhysicsLnVector::G4PhysicsLnVector(size_t theNbin)
{
type = T_G4PhysicsLnVector;
// Add extra one bin (hidden to user) to handle correctly when
// Energy=theEmax in getValue.
dataVector.resize(theNbin+1);
binVector.resize(theNbin+1);
dataVector.reserve(theNbin+1);
binVector.reserve(theNbin+1);
ptrNextTable = 0;
numberOfBin = theNbin;
dBin = 0.;
baseBin = 0.;
@@ -46,29 +49,35 @@ G4PhysicsLnVector::G4PhysicsLnVector(size_t theNbin)
lastBin = INT_MAX;
lastEnergy = -DBL_MAX;
lastValue = DBL_MAX;
}
for (size_t i=0; i<=numberOfBin; i++) {
binVector.push_back(0.0);
dataVector.push_back(0.0);
}
}
G4PhysicsLnVector::G4PhysicsLnVector(G4double theEmin,
G4double theEmax, size_t theNbin)
{
type = T_G4PhysicsLnVector;
// Add extra one bin (hidden to user) to handle correctly when
// Energy=theEmax in getValue.
dataVector.resize(theNbin+1);
binVector.resize(theNbin+1);
dataVector.reserve(theNbin+1);
binVector.reserve(theNbin+1);
ptrNextTable = 0;
numberOfBin = theNbin;
dBin = log(theEmax/theEmin) / numberOfBin;
baseBin = log(theEmin)/dBin;
for (size_t i=0; i<numberOfBin+1; i++) {
binVector(i) = exp(log(theEmin)+i*dBin);
binVector.push_back(exp(log(theEmin)+i*dBin));
dataVector.push_back(0.0);
}
edgeMin = binVector(0);
edgeMax = binVector(numberOfBin-1);
edgeMin = binVector[0];
edgeMax = binVector[numberOfBin-1];
lastBin = INT_MAX;
lastEnergy = -DBL_MAX;
@@ -77,3 +86,15 @@ G4PhysicsLnVector::G4PhysicsLnVector(G4double theEmin,
G4PhysicsLnVector::~G4PhysicsLnVector(){}
G4bool G4PhysicsLnVector::Retrieve(G4std::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;
}
return success;
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4PhysicsLogVector.cc,v 1.3 2000/11/20 17:26:48 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4PhysicsLogVector.cc,v 1.8 2001/04/03 09:15:24 kurasige Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// --------------------------------------------------------------
@@ -14,11 +14,13 @@
//
// G4PhysicsLogVector.cc
//
// History: first implementation, based on object model of
// History:
// 02 Dec. 1995, G.Cosmo : Structure created based on object model
// 15 Feb. 1996, K.Amako : Implemented the 1st version
// 01 Jul. 1996, K.Amako : Hidden bin from the user introduced
// 26 Sep. 1996, K.Amako : Constructor with only 'bin size' added.
// 26 Sep. 1996, K.Amako : Constructor with only 'bin size' added
// 11 Nov. 2000, H.Kurashige : use STL vector for dataVector and binVector
// 9 Mar. 2001, H.Kurashige : add PhysicsVector type and Retrieve
//
// --------------------------------------------------------------
@@ -27,18 +29,20 @@
G4PhysicsLogVector::G4PhysicsLogVector()
: dBin(0.), baseBin(0.)
{}
{
type = T_G4PhysicsLogVector;
}
G4PhysicsLogVector::G4PhysicsLogVector(size_t theNbin)
{
type = T_G4PhysicsLogVector;
// Add extra one bin (hidden to user) to handle correctly when
// Energy=theEmax in getValue.
dataVector.resize(theNbin+1);
binVector.resize(theNbin+1);
dataVector.reserve(theNbin+1);
binVector.reserve(theNbin+1);
ptrNextTable = 0;
numberOfBin = theNbin;
dBin = 0.;
baseBin = 0.;
@@ -49,29 +53,35 @@ G4PhysicsLogVector::G4PhysicsLogVector(size_t theNbin)
lastBin = INT_MAX;
lastEnergy = -DBL_MAX;
lastValue = DBL_MAX;
for (size_t i=0; i<=numberOfBin; i++) {
binVector.push_back(0.0);
dataVector.push_back(0.0);
}
}
G4PhysicsLogVector::G4PhysicsLogVector(G4double theEmin,
G4double theEmax, size_t theNbin)
{
type = T_G4PhysicsLogVector;
// Add extra one bin (hidden to user) to handle correctly when
// Energy=theEmax in getValue.
dataVector.resize(theNbin+1);
binVector.resize(theNbin+1);
dataVector.reserve(theNbin+1);
binVector.reserve(theNbin+1);
ptrNextTable = 0;
numberOfBin = theNbin;
dBin = log10(theEmax/theEmin) / numberOfBin;
baseBin = log10(theEmin)/dBin;
for (size_t i=0; i<numberOfBin+1; i++) {
binVector(i) = pow(10., log10(theEmin)+i*dBin);
binVector.push_back(pow(10., log10(theEmin)+i*dBin));
dataVector.push_back(0.0);
}
edgeMin = binVector(0);
edgeMax = binVector(numberOfBin-1);
edgeMin = binVector[0];
edgeMax = binVector[numberOfBin-1];
lastBin = INT_MAX;
lastEnergy = -DBL_MAX;
@@ -80,3 +90,15 @@ G4PhysicsLogVector::G4PhysicsLogVector(G4double theEmin,
G4PhysicsLogVector::~G4PhysicsLogVector(){}
G4bool G4PhysicsLogVector::Retrieve(G4std::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;
}
return success;
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4PhysicsOrderedFreeVector.cc,v 1.3 2000/11/20 17:26:49 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4PhysicsOrderedFreeVector.cc,v 1.7 2001/03/09 03:39:31 kurasige Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
////////////////////////////////////////////////////////////////////////
// PhysicsOrderedFreeVector Class Implementation
@@ -21,6 +21,8 @@
// 1998-11-11 by Peter Gumplinger
// > initialize all data members of the base class in
// derived class constructors
// 2000-11-11 by H.Kurashige
// > use STL vector for dataVector and binVector
// mail: gum@triumf.ca
//
//
@@ -40,8 +42,7 @@ G4PhysicsOrderedFreeVector::G4PhysicsOrderedFreeVector(G4double *Energies,
G4double *Values,
size_t VectorLength)
{
ptrNextTable = 0;
type = T_G4PhysicsOrderedFreeVector;
lastBin = INT_MAX;
@@ -52,16 +53,16 @@ G4PhysicsOrderedFreeVector::G4PhysicsOrderedFreeVector(G4double *Energies,
for (size_t i = 0 ; i < VectorLength ; i++)
{
binVector.insert(Energies[i]);
dataVector.insert(Values[i]);
binVector.push_back(Energies[i]);
dataVector.push_back(Values[i]);
}
edgeMin = binVector.first();
edgeMax = binVector.last();
edgeMin = binVector.front();
edgeMax = binVector.back();
}
G4PhysicsOrderedFreeVector::G4PhysicsOrderedFreeVector()
{
ptrNextTable = 0;
type = T_G4PhysicsOrderedFreeVector;
lastBin = INT_MAX;
lastEnergy = -DBL_MAX;
@@ -85,11 +86,11 @@ G4PhysicsOrderedFreeVector::~G4PhysicsOrderedFreeVector() {}
void
G4PhysicsOrderedFreeVector::InsertValues(G4double energy, G4double value)
{
binVector.insert(energy);
dataVector.insert(value);
binVector.push_back(energy);
dataVector.push_back(value);
numberOfBin++;
edgeMin = binVector.first();
edgeMax = binVector.last();
edgeMin = binVector.front();
edgeMax = binVector.back();
}
@@ -122,7 +123,7 @@ G4PhysicsOrderedFreeVector::FindValueBinLocation(G4double aValue)
G4int n2 = numberOfBin/2;
G4int n3 = numberOfBin - 1;
while (n1 != n3 - 1) {
if (aValue > dataVector(n2))
if (aValue > dataVector[n2])
n1 = n2;
else
n3 = n2;
@@ -135,9 +136,9 @@ G4double
G4PhysicsOrderedFreeVector::LinearInterpolationOfEnergy(G4double aValue,
size_t theLocBin)
{
G4double intplFactor = (aValue-dataVector(theLocBin))
/ (dataVector(theLocBin+1)-dataVector(theLocBin)); // Interpolation factor
G4double intplFactor = (aValue-dataVector[theLocBin])
/ (dataVector[theLocBin+1]-dataVector[theLocBin]); // Interpolation factor
return binVector(theLocBin) +
( binVector(theLocBin+1)-binVector(theLocBin) ) * intplFactor;
return binVector[theLocBin] +
( binVector[theLocBin+1]-binVector[theLocBin] ) * intplFactor;
}
@@ -0,0 +1,237 @@
// 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: G4PhysicsTable.cc,v 1.5 2001/04/03 07:26:38 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// ------------------------------------------------------------
// GEANT 4 class implementation
//
// G4PhysicsTable
//
// ------------------------------------------------------------
#include "G4PhysicsVector.hh"
#include "G4PhysicsTable.hh"
#include "g4std/iostream"
#include "g4std/fstream"
#include "g4std/iomanip"
G4PhysicsTable::G4PhysicsTable()
: G4PhysCollection()
{
}
G4PhysicsTable::G4PhysicsTable(size_t capacity)
: G4PhysCollection()
{
reserve(capacity);
}
G4PhysicsTable::G4PhysicsTable(const G4PhysicsTable& right)
{
*this = right;
}
G4PhysicsTable& G4PhysicsTable::operator=(const G4PhysicsTable& right)
{
if (this != &right)
{
G4PhysCollection::const_iterator itr;
for (itr=right.begin(); itr!=right.end(); ++itr)
{
G4PhysCollection::push_back(*itr);
}
}
return *this;
}
G4PhysicsTable::~G4PhysicsTable()
{
clear();
}
G4bool G4PhysicsTable::StorePhysicsTable(const G4String& fileName,
G4bool ascii)
{
G4std::ofstream fOut;
// open output file //
#ifdef G4USE_STD_NAMESPACE
if (!ascii)
fOut.open(fileName, G4std::ios::out|G4std::ios::binary);
else
#endif
fOut.open(fileName, G4std::ios::out);
// check if the file has been opened successfully
if (!fOut) {
#ifdef G4VERBOSE
G4cerr << "G4PhysicsTable::::StorePhysicsTable ";
G4cerr << " Can not open file " << fileName << G4endl;
#endif
fOut.close();
return false;
}
// Number of elements
size_t tableSize = size();
if (!ascii){
fOut.write( (char*)(&tableSize), sizeof tableSize);
} else {
fOut << tableSize << G4endl;
}
// Physics Vector
G4PhysicsTableIterator itr;
for (itr=begin(); itr!=end(); ++itr) {
G4int vType = (*itr)->GetType();
if (!ascii){
fOut.write( (char*)(&vType), sizeof vType);
} else {
fOut << vType << G4endl;
}
(*itr)->Store(fOut,ascii);
}
fOut.close();
return true;
}
G4bool G4PhysicsTable::RetrievePhysicsTable(const G4String& fileName,
G4bool ascii)
{
G4std::ifstream fIn;
// open input file //
#ifdef G4USE_STD_NAMESPACE
if (ascii)
fIn.open(fileName,G4std::ios::in|G4std::ios::binary);
else
#endif
fIn.open(fileName,G4std::ios::in);
// check if the file has been opened successfully
if (!fIn) {
#ifdef G4VERBOSE
G4cerr << "G4PhysicsTable::RetrievePhysicsTable ";
G4cerr << " Can not open file " << fileName << G4endl;
#endif
fIn.close();
return false;
}
// clear
clearAndDestroy();
// Number of elements
size_t tableSize;
if (!ascii){
fIn.read((char*)(&tableSize), sizeof tableSize);
} else {
fIn >> tableSize;
}
reserve(tableSize);
// Physics Vector
for (size_t idx=0; idx<tableSize; ++idx) {
G4int vType;
if (!ascii){
fIn.read( (char*)(&vType), sizeof vType);
} else {
fIn >> vType;
}
G4PhysicsVector* pVec = CreatePhysicsVector(vType);
if (pVec==0) {
#ifdef G4VERBOSE
G4cerr << "G4PhysicsTable::RetrievePhysicsTable ";
G4cerr << " illegal Physics Vector type " << vType << " in ";
G4cerr << fileName << G4endl;
#endif
fIn.close();
return false;
}
if (! (pVec->Retrieve(fIn,ascii)) ){
#ifdef G4VERBOSE
G4cerr << "G4PhysicsTable::RetrievePhysicsTable ";
G4cerr << " error in retreiving " << idx << "-th Physics Vector from file ";
G4cerr << fileName << G4endl;
#endif
fIn.close();
return false;
}
// add a PhysicsVector to this PhysicsTable
push_back(pVec);
}
fIn.close();
return true;
}
G4std::ostream& operator<<(G4std::ostream& out,
G4PhysicsTable& right)
{
// Printout Physics Vector
G4PhysicsTableIterator itr;
size_t i=0;
for (itr=right.begin(); itr!=right.end(); ++itr) {
out << G4std::setw(8) << i << "-th Vector ";
out << ": Type " << G4int((*itr)->GetType()) << G4endl;
out << *(*itr);
i +=1;
}
out << G4endl;
return out;
}
#include "G4PhysicsVectorType.hh"
#include "G4LPhysicsFreeVector.hh"
#include "G4PhysicsLogVector.hh"
#include "G4PhysicsFreeVector.hh"
#include "G4PhysicsOrderedFreeVector.hh"
#include "G4PhysicsLinearVector.hh"
#include "G4PhysicsLnVector.hh"
G4PhysicsVector* G4PhysicsTable::CreatePhysicsVector(G4int type)
{
G4PhysicsVector* pVector=0;
switch (type) {
case T_G4PhysicsLinearVector:
pVector = new G4PhysicsLinearVector();
break;
case T_G4PhysicsLogVector:
pVector = new G4PhysicsLogVector();
break;
case T_G4PhysicsLnVector:
pVector = new G4PhysicsLnVector();
break;
case T_G4PhysicsFreeVector:
pVector = new G4PhysicsFreeVector();
break;
case T_G4PhysicsOrderedFreeVector:
pVector = new G4PhysicsOrderedFreeVector();
break;
case T_G4LPhysicsFreeVector:
pVector = new G4LPhysicsFreeVector();
break;
default:
break;
}
return pVector;
}
+117 -64
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4PhysicsVector.cc,v 1.5 2000/11/20 17:26:49 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4PhysicsVector.cc,v 1.11 2001/03/09 13:36:56 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// --------------------------------------------------------------
@@ -14,35 +14,45 @@
//
// G4PhysicsVector.cc
//
// History: first implementation, based on object model of
// History:
// 02 Dec. 1995, G.Cosmo : Structure created based on object model
// 03 Mar. 1996, K.Amako : Implemented the 1st version
// 01 Jul. 1996, K.Amako : Hidden bin from the user introduced
// 12 Nov. 1998, K.Amako : A bug in GetVectorLength() fixed
//
// 11 Nov. 2000, H.Kurashige : use STL vector for dataVector and binVector
// 18 Jan. 2001, H.Kurashige : removed ptrNextTable
// 09 Mar. 2001, H.Kurashige : added G4PhysicsVector type
// --------------------------------------------------------------
#include "G4PhysicsVector.hh"
#include "g4std/iomanip"
G4PhysicsVector::G4PhysicsVector()
: edgeMin(0.), edgeMax(0.), numberOfBin(0),
lastEnergy(0.), lastValue(0.), lastBin(0),
ptrNextTable(0) {}
lastEnergy(0.), lastValue(0.), lastBin(0)
{
type = T_G4PhysicsVector;
}
G4PhysicsVector::~G4PhysicsVector() {}
G4PhysicsVector::~G4PhysicsVector()
{
dataVector.clear();
binVector.clear();
type = T_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) {}
{
*this=right;
}
G4PhysicsVector&
G4PhysicsVector::operator=(const G4PhysicsVector& right)
G4PhysicsVector::operator=(const G4PhysicsVector& right)
{
if (&right==this) return *this;
if (type != right.type) return *this;
type = right.type;
edgeMin = right.edgeMin;
edgeMax = right.edgeMax;
numberOfBin = right.numberOfBin;
@@ -51,9 +61,7 @@ G4PhysicsVector::operator=(const G4PhysicsVector& right)
lastBin = right.lastBin;
dataVector = right.dataVector;
binVector = right.binVector;
ptrNextTable = right.ptrNextTable;
comment = right.comment;
return *this;
}
@@ -67,66 +75,111 @@ G4int G4PhysicsVector::operator!=(const G4PhysicsVector &right) const
return (this != &right);
}
void G4PhysicsVector::PutValue(size_t binNumber, G4double theValue)
{
dataVector(binNumber) = 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) {
dataVector(binNumber+1) = theValue;
}
}
G4double G4PhysicsVector::GetLowEdgeEnergy(size_t binNumber) const
{
return binVector(binNumber);
return binVector[binNumber];
}
size_t G4PhysicsVector::GetVectorLength() const
G4bool G4PhysicsVector::Store(G4std::ofstream& fOut, G4bool ascii)
{
return numberOfBin;
// Ascii mode
if (ascii) {
fOut << *this;
return true;
}
// Binary Mode
// binning
fOut.write((char*)(&edgeMin), sizeof edgeMin);
fOut.write((char*)(&edgeMax), sizeof edgeMax);
fOut.write((char*)(&numberOfBin), sizeof numberOfBin);
// contents
size_t size = dataVector.size();
fOut.write((char*)(&size), sizeof size);
G4double* value = new G4double[2*size];
for(size_t i = 0; i < size; i++) {
value[2*i] = binVector[i];
value[2*i+1]= dataVector[i];
}
fOut.write((char*)(value), 2*size*(sizeof (G4double)));
delete [] value;
return true;
}
G4bool G4PhysicsVector::IsFilledVectorExist() const
G4bool G4PhysicsVector::Retrieve(G4std::ifstream& fIn, G4bool ascii)
{
G4bool status=false;
// clear properties;
lastEnergy=0.;
lastValue =0.;
lastBin =0;
dataVector.clear();
binVector.clear();
comment = "";
if(numberOfBin > 0) status=true;
return status;
// retrieve in ascii mode
if (ascii) {
// binning
fIn >> edgeMin >> edgeMax >> numberOfBin;
if (fIn.fail()) return false;
// contents
size_t size;
fIn >> size;
if (fIn.fail()) return false;
binVector.reserve(size);
dataVector.reserve(size);
for(size_t i = 0; i < size ; i++) {
G4double vBin, vData;
fIn >> vBin >> vData;
if (fIn.fail()) return false;
binVector.push_back(vBin);
dataVector.push_back(vData);
}
return true ;
}
// retrieve in binary mode
// binning
fIn.read((char*)(&edgeMin), sizeof edgeMin);
fIn.read((char*)(&edgeMax), sizeof edgeMax);
fIn.read((char*)(&numberOfBin), sizeof numberOfBin );
// contents
size_t size;
fIn.read((char*)(&size), sizeof size);
G4double* value = new G4double[2*size];
fIn.read((char*)(value), 2*size*(sizeof(G4double)) );
if (fIn.gcount() != 2*size*(sizeof(G4double)) ){
delete [] value;
return false;
}
binVector.reserve(size);
dataVector.reserve(size);
for(size_t i = 0; i < size; i++) {
binVector.push_back(value[2*i]);
dataVector.push_back(value[2*i+1]);
}
delete [] value;
return true;
}
void G4PhysicsVector::LinkPhysicsTable(G4RWTPtrOrderedVector<G4PhysicsVector>& theTable)
G4std::ostream& operator<<(G4std::ostream& out, const G4PhysicsVector& pv)
{
ptrNextTable = &theTable;
}
// binning
out << G4std::setprecision(12) << pv.edgeMin;
out <<" " << pv.edgeMax <<" " << pv.numberOfBin << G4endl;
G4bool G4PhysicsVector::IsLinkedTableExist() const
{
G4bool status=false;
// contents
size_t i;
out << pv.dataVector.size() << G4endl;
for(i = 0; i < pv.dataVector.size(); i++) {
out << G4std::setprecision(12) << pv.binVector[i] <<" " << pv.dataVector[i] << G4endl;
}
if(ptrNextTable != 0) status=true;
return status;
return out;
}
void G4PhysicsVector::PutComment(const G4String& theComment)
{
comment = theComment;
}
G4String G4PhysicsVector::GetComment() const
{
return comment;
}
+91 -36
View File
@@ -5,8 +5,8 @@
// 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 $
// $Id: G4StateManager.cc,v 1.3 2001/03/06 15:56:52 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// ------------------------------------------------------------
@@ -24,12 +24,31 @@
G4StateManager* G4StateManager::theStateManager = 0;
G4StateManager::G4StateManager()
:theCurrentState(PreInit),thePreviousState(PreInit)
{ theBottomDependent = 0; }
: theCurrentState(PreInit),
thePreviousState(PreInit),
theBottomDependent(0)
{
}
G4StateManager::~G4StateManager()
{
theDependentsList.clearAndDestroy();
G4VStateDependent* state=0;
while (theDependentsList.size()>0)
{
state = theDependentsList.back();
theDependentsList.pop_back();
for (G4std::vector<G4VStateDependent*>::iterator
i=theDependentsList.begin(); i!=theDependentsList.end(); i++)
{
if (*i==state)
{
theDependentsList.erase(i);
i--;
}
}
if ( state ) delete state;
}
}
G4StateManager::G4StateManager(const G4StateManager &right)
@@ -40,7 +59,8 @@ G4StateManager::G4StateManager(const G4StateManager &right)
{
}
G4StateManager& G4StateManager::operator=(const G4StateManager &right)
G4StateManager&
G4StateManager::operator=(const G4StateManager &right)
{
if (&right == this) return *this;
@@ -52,69 +72,93 @@ G4StateManager& G4StateManager::operator=(const G4StateManager &right)
return *this;
}
G4int G4StateManager::operator==(const G4StateManager &right) const
G4int
G4StateManager::operator==(const G4StateManager &right) const
{
return (this == &right);
}
G4int G4StateManager::operator!=(const G4StateManager &right) const
G4int
G4StateManager::operator!=(const G4StateManager &right) const
{
return (this != &right);
}
G4StateManager* G4StateManager::GetStateManager()
G4StateManager*
G4StateManager::GetStateManager()
{
if (!theStateManager)
{
theStateManager = new G4StateManager;
}
{
theStateManager = new G4StateManager;
}
return theStateManager;
}
G4bool G4StateManager::RegisterDependent(G4VStateDependent* aDependent,G4bool bottom)
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 ack=true;
if(!bottom)
{
theDependentsList.push_back(aDependent);
}
else
{
if(theBottomDependent)
{
theDependentsList.push_back(theBottomDependent);
}
theBottomDependent = aDependent;
}
return ack;
}
G4bool G4StateManager::DeregisterDependent(G4VStateDependent* aDependent)
G4bool
G4StateManager::DeregisterDependent(G4VStateDependent* aDependent)
{
G4VStateDependent* aD = theDependentsList.remove(aDependent);
return (aD != NULL);
G4VStateDependent* tmp = 0;
G4std::vector<G4VStateDependent*>::iterator i;
for (i=theDependentsList.begin(); i!=theDependentsList.end(); i++)
{
if (**i==*aDependent)
{
tmp = *i;
theDependentsList.erase(i);
}
}
return (tmp != 0);
}
G4ApplicationState G4StateManager::GetCurrentState()
G4ApplicationState
G4StateManager::GetCurrentState() const
{
return theCurrentState;
}
G4ApplicationState G4StateManager::GetPreviousState()
G4ApplicationState
G4StateManager::GetPreviousState() const
{
return thePreviousState;
}
G4bool G4StateManager::SetNewState(G4ApplicationState requestedState)
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);
while ((ack) && (i<theDependentsList.size()))
{
ack = theDependentsList[i]->Notify(requestedState);
i++;
}
if(theBottomDependent)
{ ack = theBottomDependent->Notify(requestedState); }
{
ack = theBottomDependent->Notify(requestedState);
}
if(!ack)
{
@@ -124,12 +168,24 @@ G4bool G4StateManager::SetNewState(G4ApplicationState requestedState)
return ack;
}
G4VStateDependent* G4StateManager::RemoveDependent(const G4VStateDependent* aDependent)
G4VStateDependent*
G4StateManager::RemoveDependent(const G4VStateDependent* aDependent)
{
return theDependentsList.remove(aDependent);
G4VStateDependent* tmp = 0;
G4std::vector<G4VStateDependent*>::iterator i;
for (i=theDependentsList.begin(); i!=theDependentsList.end(); i++)
{
if (**i==*aDependent)
{
tmp = *i;
theDependentsList.erase(i);
}
}
return tmp;
}
G4String G4StateManager::GetStateString(G4ApplicationState aState)
G4String
G4StateManager::GetStateString(G4ApplicationState aState) const
{
G4String stateName;
switch(aState)
@@ -169,4 +225,3 @@ G4String G4StateManager::GetStateString(G4ApplicationState aState)
//{
// 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-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// ----------------------------------------------------------------------
+35 -29
View File
@@ -5,18 +5,16 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4UnitsTable.cc,v 1.11 2000/11/20 17:26:49 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
// $Id: G4UnitsTable.cc,v 1.14 2001/04/02 14:29:00 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
// ------------------------------------------------------------
// GEANT 4 class implementation file
//
// ------------ class G4UnitsTable ------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//
// 17-05-98: first version, M.Maire
// 05-08-98: angstrom,microbarn,picobarn,petaelectronvolt
// 13-10-98: Units and symbols printed in fixed length
// 05-08-98: angstrom,microbarn,picobarn,petaelectronvolt, M.Maire
// 13-10-98: units and symbols printed in fixed length, M.Maire
// 01-03-01: parsec, M.Maire
// 06-03-01: migration to STL vectors, G.Cosmo
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -32,18 +30,18 @@ G4UnitsTable G4UnitDefinition::theUnitsTable;
G4UnitDefinition::G4UnitDefinition(G4String name, G4String symbol,
G4String category, G4double value)
:Name(name),SymbolName(symbol),Value(value)
: Name(name),SymbolName(symbol),Value(value)
{
//
//does the Category objet already exist ?
size_t nbCat = theUnitsTable.entries();
size_t nbCat = theUnitsTable.size();
size_t i = 0;
while ((i<nbCat)&&(theUnitsTable[i]->GetName()!=category)) i++;
if (i == nbCat) theUnitsTable.insert( new G4UnitsCategory(category));
if (i == nbCat) theUnitsTable.push_back( new G4UnitsCategory(category));
CategoryIndex = i;
//
//insert this Unit in the Unitstable
(theUnitsTable[CategoryIndex]->GetUnitsList()).insert(this);
(theUnitsTable[CategoryIndex]->GetUnitsList()).push_back(this);
//update string max length for name and symbol
theUnitsTable[i]->UpdateNameMxLen((G4int)name.length());
@@ -95,11 +93,11 @@ G4int G4UnitDefinition::operator!=(const G4UnitDefinition &right) const
G4double G4UnitDefinition::GetValueOf(G4String string)
{
if(theUnitsTable.entries()==0) BuildUnitsTable();
if(theUnitsTable.size()==0) BuildUnitsTable();
G4String name,symbol;
for (size_t i=0;i<theUnitsTable.entries();i++)
for (size_t i=0;i<theUnitsTable.size();i++)
{ G4UnitsContainer& units = theUnitsTable[i]->GetUnitsList();
for (size_t j=0;j<units.entries();j++)
for (size_t j=0;j<units.size();j++)
{ name=units[j]->GetName(); symbol=units[j]->GetSymbol();
if(string==name||string==symbol)
return units[j]->GetValue();
@@ -115,11 +113,11 @@ G4double G4UnitDefinition::GetValueOf(G4String string)
G4String G4UnitDefinition::GetCategory(G4String string)
{
if(theUnitsTable.entries()==0) BuildUnitsTable();
if(theUnitsTable.size()==0) BuildUnitsTable();
G4String name,symbol;
for (size_t i=0;i<theUnitsTable.entries();i++)
for (size_t i=0;i<theUnitsTable.size();i++)
{ G4UnitsContainer& units = theUnitsTable[i]->GetUnitsList();
for (size_t j=0;j<units.entries();j++)
for (size_t j=0;j<units.size();j++)
{ name=units[j]->GetName(); symbol=units[j]->GetSymbol();
if(string==name||string==symbol)
return theUnitsTable[i]->GetName();
@@ -147,6 +145,7 @@ void G4UnitDefinition::PrintDefinition()
void G4UnitDefinition::BuildUnitsTable()
{
//Length
new G4UnitDefinition( "parsec","pc" ,"Length",parsec);
new G4UnitDefinition( "kilometer","km" ,"Length",kilometer);
new G4UnitDefinition( "meter","m" ,"Length",meter);
new G4UnitDefinition("centimeter","cm" ,"Length",centimeter);
@@ -263,7 +262,7 @@ void G4UnitDefinition::BuildUnitsTable()
void G4UnitDefinition::PrintUnitsTable()
{
G4cout << "\n ----- The Table of Units ----- \n";
for(size_t i=0;i<theUnitsTable.entries();i++)
for(size_t i=0;i<theUnitsTable.size();i++)
theUnitsTable[i]->PrintCategory();
}
@@ -320,7 +319,7 @@ G4int G4UnitsCategory::operator!=(const G4UnitsCategory &right) const
void G4UnitsCategory::PrintCategory()
{
G4cout << "\n category: " << Name << G4endl;
for(size_t i=0;i<UnitsList.entries();i++)
for(size_t i=0;i<UnitsList.size();i++)
UnitsList[i]->PrintDefinition();
}
@@ -330,14 +329,14 @@ G4BestUnit::G4BestUnit(G4double value,G4String category)
{
// find the category
G4UnitsTable& theUnitsTable = G4UnitDefinition::GetUnitsTable();
size_t nbCat = theUnitsTable.entries();
size_t nbCat = theUnitsTable.size();
size_t i = 0;
while
((i<nbCat)&&(theUnitsTable[i]->GetName()!=category)) i++;
if (i == nbCat)
{ G4cout << " G4BestUnit: the category " << category
<< " does not exist; --> G4Exception" << G4endl;
G4Exception(" ");
<< " does not exist !!" << G4endl;
G4Exception("Missing unit category !");
}
//
IndexOfCategory = i;
@@ -351,7 +350,7 @@ G4BestUnit::G4BestUnit(const G4ThreeVector& value,G4String category)
{
// find the category
G4UnitsTable& theUnitsTable = G4UnitDefinition::GetUnitsTable();
size_t nbCat = theUnitsTable.entries();
size_t nbCat = theUnitsTable.size();
size_t i = 0;
while
((i<nbCat)&&(theUnitsTable[i]->GetName()!=category)) i++;
@@ -389,7 +388,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 (size_t k=0; k<List.entries(); k++)
for (size_t k=0; k<List.size(); k++)
{
G4double unit = List[k]->GetValue();
if (value==DBL_MAX) {if(unit>umax) {umax=unit; ksup=k;}}
@@ -405,10 +404,17 @@ G4std::ostream& operator<<(G4std::ostream& flux, G4BestUnit a)
for (G4int j=0; j<a.nbOfVals; j++)
{flux << a.Value[j]/(List[index]->GetValue()) << " ";}
G4long oldform = G4cout.setf(G4std::ios::left,G4std::ios::adjustfield);
#ifdef G4USE_STD_NAMESPACE
std::ios::fmtflags oldform = G4cout.flags();
#else
G4long oldform = G4cout.flags();
#endif
G4cout.setf(G4std::ios::left,G4std::ios::adjustfield);
flux << G4std::setw(len) << List[index]->GetSymbol();
G4cout.setf(oldform,G4std::ios::adjustfield);
G4cout.flags(oldform);
return flux;
}
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4VStateDependent.cc,v 1.2 2000/11/20 17:26:49 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// ------------------------------------------------------------
+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-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// --------------------------------------------------------------