Import Geant4 1.0.0 source tree
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
// the GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PhysicsVector.hh,v 1.1 1999/01/07 16:09:02 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
// $Id: G4PhysicsVector.hh,v 1.3 1999/11/16 17:40:43 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
@@ -14,13 +14,14 @@
|
||||
//
|
||||
// G4PhysicsVector.hh
|
||||
//
|
||||
// Description:
|
||||
// Class description:
|
||||
//
|
||||
// A physics vector which has values of energy-loss, cross-section,
|
||||
// and other physics values of a particle in matter in a given
|
||||
// range of the energy, momentum, etc.
|
||||
// This class serves as the base class for a vector having various
|
||||
// energy scale, for example like 'log', 'linear', 'free', etc.
|
||||
//
|
||||
|
||||
// History:
|
||||
// 02 Dec. 1995, G.Cosmo : Structure created based on object model
|
||||
// 03 Mar. 1996, K.Amako : Implemented the 1st version
|
||||
@@ -35,15 +36,15 @@
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4DataVector.hh"
|
||||
#include <rw/tpordvec.h>
|
||||
#include "g4rw/tpordvec.h"
|
||||
|
||||
class G4PhysicsVector
|
||||
{
|
||||
public:
|
||||
|
||||
// Constructor and destructor
|
||||
G4PhysicsVector(){};
|
||||
virtual ~G4PhysicsVector(){};
|
||||
G4PhysicsVector();
|
||||
virtual ~G4PhysicsVector();
|
||||
|
||||
// Public functions
|
||||
G4double GetValue(G4double theEnergy, G4bool& isOutRange);
|
||||
@@ -84,11 +85,11 @@ class G4PhysicsVector
|
||||
G4bool IsFilledVectorExist() const;
|
||||
// Is non-empty physics vector already exist?
|
||||
|
||||
void LinkPhysicsTable(RWTPtrOrderedVector<G4PhysicsVector>& theTable);
|
||||
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 RWTPtrOrderedVector<G4PhysicsVector>* GetNextTable() const;
|
||||
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).
|
||||
@@ -112,7 +113,7 @@ class G4PhysicsVector
|
||||
G4DataVector dataVector; // Vector to keep the crossection/energyloss
|
||||
G4DataVector binVector; // Vector to keep the low edge value of bin
|
||||
|
||||
RWTPtrOrderedVector<G4PhysicsVector>* ptrNextTable;
|
||||
G4RWTPtrOrderedVector<G4PhysicsVector>* ptrNextTable;
|
||||
// Link to the connected physics table
|
||||
|
||||
G4double LinearInterpolation(G4double theEnergy, size_t theLocBin);
|
||||
@@ -125,100 +126,6 @@ class G4PhysicsVector
|
||||
G4String comment;
|
||||
};
|
||||
|
||||
|
||||
inline G4double G4PhysicsVector::operator[](const size_t binNumber) const
|
||||
{
|
||||
return dataVector[binNumber];
|
||||
}
|
||||
|
||||
|
||||
inline G4double G4PhysicsVector::operator()(const size_t binNumber) const
|
||||
{
|
||||
return dataVector(binNumber);
|
||||
}
|
||||
|
||||
|
||||
inline const RWTPtrOrderedVector<G4PhysicsVector>*
|
||||
G4PhysicsVector::GetNextTable() const
|
||||
{
|
||||
return ptrNextTable;
|
||||
}
|
||||
|
||||
|
||||
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
|
||||
// there is an extra bin hidden from a user at locBin=numberOfBin,
|
||||
// the following interpolation is valid even the current locBin=
|
||||
// numberOfBin-1.
|
||||
|
||||
G4double intplFactor = (theEnergy-binVector(theLocBin))
|
||||
/ (binVector(theLocBin+1)-binVector(theLocBin)); // Interpolation factor
|
||||
|
||||
return dataVector(theLocBin) +
|
||||
( dataVector(theLocBin+1)-dataVector(theLocBin) ) * intplFactor;
|
||||
}
|
||||
|
||||
|
||||
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
|
||||
// value 'theEnergy' lies between the last energy and low edge of of the
|
||||
// bin of last call, then the last bin location is used.
|
||||
|
||||
isOutRange = false; // No range check.
|
||||
|
||||
size_t locBin;
|
||||
|
||||
if( theEnergy == lastEnergy ) {
|
||||
return lastValue;
|
||||
}
|
||||
else if( (theEnergy < lastEnergy) &&
|
||||
(theEnergy >= binVector(lastBin)) ) {
|
||||
locBin = lastBin;
|
||||
|
||||
lastEnergy = theEnergy;
|
||||
lastValue = LinearInterpolation(theEnergy, locBin);
|
||||
return lastValue;
|
||||
}
|
||||
else if( theEnergy < edgeMin ){
|
||||
lastBin = 0;
|
||||
lastEnergy = theEnergy;
|
||||
lastValue = dataVector(0);
|
||||
return lastValue;
|
||||
}
|
||||
else if( theEnergy >= edgeMax ){
|
||||
lastBin = numberOfBin-1;
|
||||
lastEnergy = theEnergy;
|
||||
lastValue = dataVector( numberOfBin-1 );
|
||||
return lastValue;
|
||||
}
|
||||
else {
|
||||
locBin = FindBinLocation(theEnergy);
|
||||
|
||||
lastBin = locBin;
|
||||
lastEnergy = theEnergy;
|
||||
lastValue = LinearInterpolation(theEnergy, locBin);
|
||||
return lastValue;
|
||||
}
|
||||
}
|
||||
#include "G4PhysicsVector.icc"
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user