Import Geant4 10.7.0.beta source tree
This commit is contained in:
@@ -23,154 +23,137 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// G4Physics2DVector
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
//
|
||||
// G4Physics2DVector.hh
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
// A 2-dimentional vector with linear interpolation.
|
||||
// A 2-dimentional vector with linear interpolation.
|
||||
|
||||
// Author: Vladimir Ivanchenko
|
||||
//
|
||||
// Creation date: 25.09.2011
|
||||
//
|
||||
// Modified:
|
||||
// 16.05.2013 V.Ivanchenko removed cache; changed signature of
|
||||
// several methods; all run time methods become const;
|
||||
// the class become read only in run time
|
||||
//---------------------------------------------------------------
|
||||
// Author: Vladimir Ivanchenko, 25.09.2011
|
||||
// --------------------------------------------------------------------
|
||||
#ifndef G4Physics2DVector_hh
|
||||
#define G4Physics2DVector_hh 1
|
||||
|
||||
#ifndef G4Physics2DVector_h
|
||||
#define G4Physics2DVector_h 1
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4ios.hh"
|
||||
#include "G4PhysicsVectorType.hh"
|
||||
#include "G4ios.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
typedef std::vector<G4double> G4PV2DDataVector;
|
||||
using G4PV2DDataVector = std::vector<G4double>;
|
||||
|
||||
class G4Physics2DVector
|
||||
class G4Physics2DVector
|
||||
{
|
||||
public: // with description
|
||||
|
||||
public:
|
||||
G4Physics2DVector();
|
||||
// Vector will be filled via Retrieve method
|
||||
|
||||
explicit G4Physics2DVector(size_t nx, size_t ny);
|
||||
explicit G4Physics2DVector(std::size_t nx, std::size_t ny);
|
||||
// Vector will be filled via Put methods
|
||||
|
||||
G4Physics2DVector(const G4Physics2DVector&);
|
||||
G4Physics2DVector& operator=(const G4Physics2DVector&);
|
||||
// Copy constructor and assignment operator.
|
||||
// Copy constructor and assignment operator
|
||||
|
||||
G4bool operator==(const G4Physics2DVector& right) const = delete;
|
||||
G4bool operator!=(const G4Physics2DVector& right) const = delete;
|
||||
|
||||
~G4Physics2DVector();
|
||||
// destructor
|
||||
|
||||
G4double Value(G4double x, G4double y,
|
||||
size_t& lastidx, size_t& lastidy) const;
|
||||
// Destructor
|
||||
|
||||
G4double Value(G4double x, G4double y, std::size_t& lastidx,
|
||||
std::size_t& lastidy) const;
|
||||
G4double Value(G4double x, G4double y) const;
|
||||
// Main method to interpolate 2D vector
|
||||
// Consumer class should provide initial values
|
||||
// lastidx and lastidy,
|
||||
// Consumer class should provide initial values of lastidx and lastidy
|
||||
|
||||
inline void PutX(size_t idx, G4double value);
|
||||
inline void PutY(size_t idy, G4double value);
|
||||
inline void PutValue(size_t idx, size_t idy, G4double value);
|
||||
inline void PutX(std::size_t idx, G4double value);
|
||||
inline void PutY(std::size_t idy, G4double value);
|
||||
inline void PutValue(std::size_t idx, std::size_t idy, G4double value);
|
||||
void PutVectors(const std::vector<G4double>& vecX,
|
||||
const std::vector<G4double>& vecY);
|
||||
// Methods to fill vector
|
||||
// Take note that the 'index' starts from '0'.
|
||||
const std::vector<G4double>& vecY);
|
||||
// Methods to fill vector
|
||||
// Take note that the 'index' starts from '0'
|
||||
|
||||
void ScaleVector(G4double factor);
|
||||
// Scale all values of the vector by factor,
|
||||
// This method may be applied
|
||||
// for example after Retrieve a vector from an external file to
|
||||
// convert values into Geant4 units
|
||||
// Scale all values of the vector by factor.
|
||||
// This method may be applied for example after Retrieve a vector
|
||||
// from an external file to convert values into Geant4 units
|
||||
|
||||
G4double
|
||||
FindLinearX(G4double rand, G4double y, size_t& lastidy) const;
|
||||
G4double FindLinearX(G4double rand, G4double y, std::size_t& lastidy) const;
|
||||
inline G4double FindLinearX(G4double rand, G4double y) const;
|
||||
// Find Y using linear interpolation for Y-vector
|
||||
// filled by cumulative probability function
|
||||
// value of rand should be between 0 and 1
|
||||
// Find Y using linear interpolation for Y-vector filled by cumulative
|
||||
// probability function value of rand should be between 0 and 1
|
||||
|
||||
inline G4double GetX(size_t index) const;
|
||||
inline G4double GetY(size_t index) const;
|
||||
inline G4double GetValue(size_t idx, size_t idy) const;
|
||||
inline G4double GetX(std::size_t index) const;
|
||||
inline G4double GetY(std::size_t index) const;
|
||||
inline G4double GetValue(std::size_t idx, std::size_t idy) const;
|
||||
// Returns simply the values of the vector by index
|
||||
// of the energy vector. The boundary check will not be done.
|
||||
// of the energy vector. The boundary check will not be done
|
||||
|
||||
inline size_t FindBinLocationX(G4double x, size_t lastidx) const;
|
||||
inline size_t FindBinLocationY(G4double y, size_t lastidy) const;
|
||||
// Find the bin# in which theEnergy belongs
|
||||
// Starting from 0
|
||||
inline std::size_t FindBinLocationX(const G4double x,
|
||||
const std::size_t lastidx) const;
|
||||
inline std::size_t FindBinLocationY(const G4double y,
|
||||
const std::size_t lastidy) const;
|
||||
// Find the bin# in which theEnergy belongs. Starting from 0
|
||||
|
||||
inline size_t GetLengthX() const;
|
||||
inline size_t GetLengthY() const;
|
||||
// Get the lengths of the vector.
|
||||
inline std::size_t GetLengthX() const;
|
||||
inline std::size_t GetLengthY() const;
|
||||
// Get the lengths of the vector
|
||||
|
||||
inline G4PhysicsVectorType GetType() const;
|
||||
// Get physics vector type
|
||||
|
||||
inline void SetBicubicInterpolation(G4bool);
|
||||
// Activate/deactivate bicubic interpolation.
|
||||
// Activate/deactivate bicubic interpolation
|
||||
|
||||
void Store(std::ofstream& fOut) const;
|
||||
G4bool Retrieve(std::ifstream& fIn);
|
||||
// To store/retrieve persistent data to/from file streams.
|
||||
// To store/retrieve persistent data to/from file streams
|
||||
|
||||
inline void SetVerboseLevel(G4int value);
|
||||
|
||||
protected:
|
||||
|
||||
protected:
|
||||
void PrepareVectors();
|
||||
|
||||
void ClearVectors();
|
||||
|
||||
void CopyData(const G4Physics2DVector& vec);
|
||||
|
||||
G4double BicubicInterpolation(G4double x, G4double y,
|
||||
size_t idx, size_t idy) const;
|
||||
// Bicubic interpolation of 2D vector
|
||||
G4double BicubicInterpolation(const G4double x, const G4double y,
|
||||
const std::size_t idx,
|
||||
const std::size_t idy) const;
|
||||
// Bicubic interpolation of 2D vector
|
||||
|
||||
size_t FindBinLocation(G4double z, const G4PV2DDataVector&) const;
|
||||
// Main method to local bin
|
||||
|
||||
inline size_t FindBin(G4double z, const G4PV2DDataVector&,
|
||||
size_t idz, size_t idzmax) const;
|
||||
|
||||
private:
|
||||
inline std::size_t FindBin(const G4double z, const G4PV2DDataVector&,
|
||||
const std::size_t idz,
|
||||
const std::size_t idzmax) const;
|
||||
|
||||
private:
|
||||
G4double InterpolateLinearX(G4PV2DDataVector& v, G4double rand) const;
|
||||
|
||||
inline G4double DerivativeX(size_t idx, size_t idy, G4double fac) const;
|
||||
inline G4double DerivativeY(size_t idx, size_t idy, G4double fac) const;
|
||||
inline G4double DerivativeXY(size_t idx, size_t idy, G4double fac) const;
|
||||
inline G4double DerivativeX(std::size_t idx, std::size_t idy,
|
||||
G4double fac) const;
|
||||
inline G4double DerivativeY(std::size_t idx, std::size_t idy,
|
||||
G4double fac) const;
|
||||
inline G4double DerivativeXY(std::size_t idx, std::size_t idy,
|
||||
G4double fac) const;
|
||||
// computation of derivatives
|
||||
|
||||
G4bool operator==(const G4Physics2DVector &right) const = delete;
|
||||
G4bool operator!=(const G4Physics2DVector &right) const = delete;
|
||||
G4PhysicsVectorType type = T_G4PhysicsFreeVector;
|
||||
// The type of PhysicsVector (enumerator)
|
||||
|
||||
G4PhysicsVectorType type; // The type of PhysicsVector (enumerator)
|
||||
std::size_t numberOfXNodes = 0;
|
||||
std::size_t numberOfYNodes = 0;
|
||||
|
||||
size_t numberOfXNodes;
|
||||
size_t numberOfYNodes;
|
||||
|
||||
G4PV2DDataVector xVector;
|
||||
G4PV2DDataVector yVector;
|
||||
G4PV2DDataVector xVector;
|
||||
G4PV2DDataVector yVector;
|
||||
std::vector<G4PV2DDataVector*> value;
|
||||
|
||||
G4int verboseLevel;
|
||||
G4bool useBicubic;
|
||||
G4int verboseLevel = 0;
|
||||
G4bool useBicubic = false;
|
||||
};
|
||||
|
||||
#include "G4Physics2DVector.icc"
|
||||
|
||||
Reference in New Issue
Block a user