G4PhysicsFreeVector Class Reference

#include <G4PhysicsFreeVector.hh>

Inheritance diagram for G4PhysicsFreeVector:

G4PhysicsVector

Public Member Functions

 G4PhysicsFreeVector ()
 G4PhysicsFreeVector (size_t theNbin)
 G4PhysicsFreeVector (const G4DataVector &binVector, const G4DataVector &dataVector)
virtual ~G4PhysicsFreeVector ()
void PutValue (size_t binNumber, G4double binValue, G4double dataValue)

Protected Member Functions

virtual size_t FindBinLocation (G4double theEnergy) const

Detailed Description

Definition at line 62 of file G4PhysicsFreeVector.hh.


Constructor & Destructor Documentation

G4PhysicsFreeVector::G4PhysicsFreeVector (  ) 

Definition at line 49 of file G4PhysicsFreeVector.cc.

References T_G4PhysicsFreeVector, and G4PhysicsVector::type.

00050   : G4PhysicsVector()
00051 {
00052   type = T_G4PhysicsFreeVector;
00053 }

G4PhysicsFreeVector::G4PhysicsFreeVector ( size_t  theNbin  )  [explicit]

Definition at line 55 of file G4PhysicsFreeVector.cc.

References G4PhysicsVector::binVector, G4PhysicsVector::dataVector, G4PhysicsVector::numberOfNodes, T_G4PhysicsFreeVector, and G4PhysicsVector::type.

00056   : G4PhysicsVector()
00057 {
00058   type = T_G4PhysicsFreeVector;
00059   numberOfNodes = theNbin;
00060 
00061   dataVector.reserve(numberOfNodes);
00062   binVector.reserve(numberOfNodes);
00063 
00064   for (size_t i=0; i<numberOfNodes; i++)
00065   {
00066      binVector.push_back(0.0);
00067      dataVector.push_back(0.0);
00068   }
00069 }  

G4PhysicsFreeVector::G4PhysicsFreeVector ( const G4DataVector binVector,
const G4DataVector dataVector 
)

Definition at line 71 of file G4PhysicsFreeVector.cc.

References G4PhysicsVector::binVector, G4PhysicsVector::dataVector, G4PhysicsVector::edgeMax, G4PhysicsVector::edgeMin, G4PhysicsVector::numberOfNodes, T_G4PhysicsFreeVector, and G4PhysicsVector::type.

00073 {
00074   type = T_G4PhysicsFreeVector;
00075   numberOfNodes = theBinVector.size();
00076 
00077   dataVector.reserve(numberOfNodes);
00078   binVector.reserve(numberOfNodes);
00079 
00080   for (size_t i=0; i<numberOfNodes; i++)
00081   {
00082      binVector.push_back(theBinVector[i]);
00083      dataVector.push_back(theDataVector[i]);
00084   }
00085 
00086   edgeMin = binVector[0];
00087   edgeMax = binVector[numberOfNodes-1];
00088 }  

G4PhysicsFreeVector::~G4PhysicsFreeVector (  )  [virtual]

Definition at line 90 of file G4PhysicsFreeVector.cc.

00091 {
00092 }


Member Function Documentation

size_t G4PhysicsFreeVector::FindBinLocation ( G4double  theEnergy  )  const [protected, virtual]

Implements G4PhysicsVector.

Definition at line 112 of file G4PhysicsFreeVector.cc.

References G4PhysicsVector::binVector, and G4PhysicsVector::numberOfNodes.

00113 {
00114   // For G4PhysicsFreeVector, FindBinLocation is implemented using
00115   // the binary search algorithm.
00116   //
00117   // Because this is a virtual function, it is accessed through a
00118   // pointer to the G4PhysicsVector object for most usages. In this
00119   // case, 'inline' will not be invoked. However, there is a possibility 
00120   // that the user access to the G4PhysicsFreeVector object directly and 
00121   // not through pointers or references. In this case, the 'inline' will
00122   // be invoked. (See R.B.Murray, "C++ Strategies and Tactics", Chap.6.6)
00123 
00124   size_t lowerBound = 0;
00125   size_t upperBound = numberOfNodes-2;
00126 
00127   while (lowerBound <= upperBound)
00128   {
00129     size_t midBin = (lowerBound + upperBound)/2;
00130     if( theEnergy < binVector[midBin] )
00131        { upperBound = midBin-1; }
00132     else
00133        { lowerBound = midBin+1; }
00134   }
00135 
00136   return upperBound;
00137 }

void G4PhysicsFreeVector::PutValue ( size_t  binNumber,
G4double  binValue,
G4double  dataValue 
)

Definition at line 94 of file G4PhysicsFreeVector.cc.

References G4PhysicsVector::binVector, G4PhysicsVector::dataVector, G4PhysicsVector::edgeMax, G4PhysicsVector::edgeMin, and G4PhysicsVector::numberOfNodes.

Referenced by G4PenelopeCrossSection::AddCrossSectionPoint(), G4PenelopeCrossSection::AddShellCrossSectionPoint(), G4PartialWidthTable::AddWidths(), G4NuclNuclDiffuseElastic::BuildAngleTable(), G4DiffuseElastic::BuildAngleTable(), G4PAIPhotonModel::BuildPAIonisationTable(), G4PAIModel::BuildPAIonisationTable(), G4XNDeltaTable::CrossSectionTable(), G4XDeltaDeltaTable::CrossSectionTable(), G4VXTRenergyLoss::GetAngleVector(), G4EMDissociationCrossSection::GetCrossSectionForProjectile(), G4PenelopeBremsstrahlungFS::SampleGammaEnergy(), G4NuclNuclDiffuseElastic::TestAngleTable(), and G4DiffuseElastic::TestAngleTable().

00097 {
00098   binVector[theBinNumber]  = theBinValue;
00099   dataVector[theBinNumber] = theDataValue;
00100 
00101   if( theBinNumber == numberOfNodes-1 )
00102   {
00103      edgeMax = binVector[numberOfNodes-1];
00104   }
00105 
00106   if( theBinNumber == 0 )
00107   {
00108      edgeMin = binVector[0];
00109   }
00110 }


The documentation for this class was generated from the following files:
Generated on Mon May 27 17:52:54 2013 for Geant4 by  doxygen 1.4.7