Geant4  10.02.p03
G4PhysicsOrderedFreeVector Class Reference

#include <G4PhysicsOrderedFreeVector.hh>

Inheritance diagram for G4PhysicsOrderedFreeVector:
Collaboration diagram for G4PhysicsOrderedFreeVector:

Public Member Functions

 G4PhysicsOrderedFreeVector ()
 
 G4PhysicsOrderedFreeVector (G4double *Energies, G4double *Values, size_t VectorLength)
 
virtual ~G4PhysicsOrderedFreeVector ()
 
void InsertValues (G4double energy, G4double value)
 
G4double GetEnergy (G4double aValue)
 
G4double GetMaxValue ()
 
G4double GetMinValue ()
 
G4double GetMaxLowEdgeEnergy ()
 
G4double GetMinLowEdgeEnergy ()
 
void DumpValues ()
 
- Public Member Functions inherited from G4PhysicsVector
 G4PhysicsVector (G4bool spline=false)
 
 G4PhysicsVector (const G4PhysicsVector &)
 
G4PhysicsVectoroperator= (const G4PhysicsVector &)
 
virtual ~G4PhysicsVector ()
 
G4double Value (G4double theEnergy, size_t &lastidx) const
 
G4double Value (G4double theEnergy) const
 
G4double GetValue (G4double theEnergy, G4bool &isOutRange) const
 
G4int operator== (const G4PhysicsVector &right) const
 
G4int operator!= (const G4PhysicsVector &right) const
 
G4double operator[] (const size_t binNumber) const
 
G4double operator() (const size_t binNumber) const
 
void PutValue (size_t index, G4double theValue)
 
virtual void ScaleVector (G4double factorE, G4double factorV)
 
G4double Energy (size_t index) const
 
G4double GetMaxEnergy () const
 
G4double GetLowEdgeEnergy (size_t binNumber) const
 
size_t GetVectorLength () const
 
size_t FindBin (G4double energy, size_t idx) const
 
void FillSecondDerivatives ()
 
void ComputeSecDerivatives ()
 
void ComputeSecondDerivatives (G4double firstPointDerivative, G4double endPointDerivative)
 
G4double FindLinearEnergy (G4double rand) const
 
G4bool IsFilledVectorExist () const
 
G4PhysicsVectorType GetType () const
 
void SetSpline (G4bool)
 
virtual G4bool Store (std::ofstream &fOut, G4bool ascii=false)
 
virtual G4bool Retrieve (std::ifstream &fIn, G4bool ascii=false)
 
void SetVerboseLevel (G4int value)
 
G4int GetVerboseLevel (G4int)
 

Private Member Functions

size_t FindValueBinLocation (G4double aValue)
 
G4double LinearInterpolationOfEnergy (G4double aValue, size_t theLocBin)
 

Additional Inherited Members

- Protected Member Functions inherited from G4PhysicsVector
void DeleteData ()
 
void CopyData (const G4PhysicsVector &vec)
 
- Protected Attributes inherited from G4PhysicsVector
G4PhysicsVectorType type
 
G4double edgeMin
 
G4double edgeMax
 
size_t numberOfNodes
 
G4PVDataVector dataVector
 
G4PVDataVector binVector
 
G4PVDataVector secDerivative
 
G4double dBin
 
G4double baseBin
 
G4int verboseLevel
 

Detailed Description

Definition at line 67 of file G4PhysicsOrderedFreeVector.hh.

Constructor & Destructor Documentation

◆ G4PhysicsOrderedFreeVector() [1/2]

G4PhysicsOrderedFreeVector::G4PhysicsOrderedFreeVector ( )

Definition at line 75 of file G4PhysicsOrderedFreeVector.cc.

76  : G4PhysicsVector()
77 {
79 }
G4PhysicsVector(G4bool spline=false)
G4PhysicsVectorType type

◆ G4PhysicsOrderedFreeVector() [2/2]

G4PhysicsOrderedFreeVector::G4PhysicsOrderedFreeVector ( G4double Energies,
G4double Values,
size_t  VectorLength 
)

Definition at line 62 of file G4PhysicsOrderedFreeVector.cc.

65  : G4PhysicsVector()
66 {
68 
69  for (size_t i = 0 ; i < VectorLength ; ++i)
70  {
71  InsertValues(Energies[i], Values[i]);
72  }
73 }
G4PhysicsVector(G4bool spline=false)
void InsertValues(G4double energy, G4double value)
G4PhysicsVectorType type
Here is the call graph for this function:

◆ ~G4PhysicsOrderedFreeVector()

G4PhysicsOrderedFreeVector::~G4PhysicsOrderedFreeVector ( )
virtual

Definition at line 85 of file G4PhysicsOrderedFreeVector.cc.

85 {}

Member Function Documentation

◆ DumpValues()

void G4PhysicsOrderedFreeVector::DumpValues ( )

Definition at line 141 of file G4PhysicsOrderedFreeVector.cc.

142 {
143  for (size_t i = 0; i < numberOfNodes; i++)
144  {
145  G4cout << binVector[i] << "\t" << dataVector[i] << G4endl;
146  }
147 }
G4PVDataVector dataVector
G4PVDataVector binVector
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
Here is the caller graph for this function:

◆ FindValueBinLocation()

size_t G4PhysicsOrderedFreeVector::FindValueBinLocation ( G4double  aValue)
private

Definition at line 122 of file G4PhysicsOrderedFreeVector.cc.

123 {
124  size_t bin = std::lower_bound(dataVector.begin(), dataVector.end(), aValue)
125  - dataVector.begin() - 1;
126  bin = std::min(bin, numberOfNodes-2);
127  return bin;
128 }
G4PVDataVector dataVector
float bin[41]
Definition: plottest35.C:14
Here is the caller graph for this function:

◆ GetEnergy()

G4double G4PhysicsOrderedFreeVector::GetEnergy ( G4double  aValue)

Definition at line 108 of file G4PhysicsOrderedFreeVector.cc.

109 {
110  G4double e;
111  if (aValue <= GetMinValue()) {
112  e = edgeMin;
113  } else if (aValue >= GetMaxValue()) {
114  e = edgeMax;
115  } else {
116  size_t closestBin = FindValueBinLocation(aValue);
117  e = LinearInterpolationOfEnergy(aValue, closestBin);
118  }
119  return e;
120 }
G4double LinearInterpolationOfEnergy(G4double aValue, size_t theLocBin)
double G4double
Definition: G4Types.hh:76
size_t FindValueBinLocation(G4double aValue)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetMaxLowEdgeEnergy()

G4double G4PhysicsOrderedFreeVector::GetMaxLowEdgeEnergy ( )
inline
Here is the caller graph for this function:

◆ GetMaxValue()

G4double G4PhysicsOrderedFreeVector::GetMaxValue ( )
inline
Here is the caller graph for this function:

◆ GetMinLowEdgeEnergy()

G4double G4PhysicsOrderedFreeVector::GetMinLowEdgeEnergy ( )
inline
Here is the caller graph for this function:

◆ GetMinValue()

G4double G4PhysicsOrderedFreeVector::GetMinValue ( )
inline
Here is the caller graph for this function:

◆ InsertValues()

void G4PhysicsOrderedFreeVector::InsertValues ( G4double  energy,
G4double  value 
)

Definition at line 91 of file G4PhysicsOrderedFreeVector.cc.

92 {
93  std::vector<G4double>::iterator binLoc =
94  std::lower_bound(binVector.begin(), binVector.end(), energy);
95 
96  size_t binIdx = binLoc - binVector.begin(); // Iterator difference!
97 
98  std::vector<G4double>::iterator dataLoc = dataVector.begin() + binIdx;
99 
100  binVector.insert(binLoc, energy);
101  dataVector.insert(dataLoc, value);
102 
103  ++numberOfNodes;
104  edgeMin = binVector.front();
105  edgeMax = binVector.back();
106 }
G4PVDataVector dataVector
G4PVDataVector binVector
double energy
Definition: plottest35.C:25
Here is the caller graph for this function:

◆ LinearInterpolationOfEnergy()

G4double G4PhysicsOrderedFreeVector::LinearInterpolationOfEnergy ( G4double  aValue,
size_t  theLocBin 
)
private

Definition at line 130 of file G4PhysicsOrderedFreeVector.cc.

132 {
133  G4double res = binVector[bin];
134  G4double del = dataVector[bin+1] - dataVector[bin];
135  if(del > 0.0) {
136  res += (aValue - dataVector[bin])*(binVector[bin+1] - res)/del;
137  }
138  return res;
139 }
G4PVDataVector dataVector
float bin[41]
Definition: plottest35.C:14
G4PVDataVector binVector
double G4double
Definition: G4Types.hh:76
Here is the caller graph for this function:

The documentation for this class was generated from the following files: