00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045 #ifndef G4Physics2DVector_h
00046 #define G4Physics2DVector_h 1
00047
00048 #include "globals.hh"
00049 #include "G4ios.hh"
00050
00051 #include <iostream>
00052 #include <fstream>
00053 #include <vector>
00054
00055 #include "G4Physics2DVectorCache.hh"
00056 #include "G4PhysicsVectorType.hh"
00057
00058 typedef std::vector<G4double> G4PV2DDataVector;
00059
00060 class G4Physics2DVector
00061 {
00062 public:
00063
00064 G4Physics2DVector();
00065 G4Physics2DVector(size_t nx, size_t ny);
00066
00067
00068 G4Physics2DVector(const G4Physics2DVector&);
00069 G4Physics2DVector& operator=(const G4Physics2DVector&);
00070
00071
00072 ~G4Physics2DVector();
00073
00074
00075 inline G4double Value(G4double x, G4double y);
00076
00077
00078 inline void PutX(size_t idx, G4double value);
00079 inline void PutY(size_t idy, G4double value);
00080 inline void PutValue(size_t idx, size_t idy, G4double value);
00081 void PutVectors(const std::vector<G4double>& vecX,
00082 const std::vector<G4double>& vecY);
00083
00084
00085
00086 void ScaleVector(G4double factor);
00087
00088
00089
00090
00091
00092 inline G4double GetX(size_t index) const;
00093 inline G4double GetY(size_t index) const;
00094 inline G4double GetValue(size_t idx, size_t idy) const;
00095
00096
00097
00098 inline size_t GetLengthX() const;
00099 inline size_t GetLengthY() const;
00100
00101
00102 inline G4PhysicsVectorType GetType() const;
00103
00104
00105 inline void SetBicubicInterpolation(G4bool);
00106
00107
00108 void Store(std::ofstream& fOut);
00109 G4bool Retrieve(std::ifstream& fIn);
00110
00111
00112 inline G4double GetLastX() const;
00113 inline G4double GetLastY() const;
00114 inline G4double GetLastValue() const;
00115 inline size_t GetLastBinX() const;
00116 inline size_t GetLastBinY() const;
00117
00118
00119 inline void SetVerboseLevel(G4int value);
00120 inline G4int GetVerboseLevel() const;
00121
00122
00123 protected:
00124
00125 void PrepareVectors();
00126
00127 void ClearVectors();
00128
00129 void CopyData(const G4Physics2DVector& vec);
00130
00131 void ComputeValue(G4double x, G4double y);
00132
00133
00134
00135 void BicubicInterpolation(size_t idx, size_t idy);
00136
00137
00138 size_t FindBinLocation(G4double z, const G4PV2DDataVector&);
00139
00140
00141 inline void FindBin(G4double z, const G4PV2DDataVector&,
00142 size_t& lastidx);
00143 inline void FindBinLocationX(G4double x);
00144 inline void FindBinLocationY(G4double y);
00145
00146
00147
00148 private:
00149
00150 inline G4double DerivativeX(size_t idx, size_t idy, G4double fac);
00151 inline G4double DerivativeY(size_t idx, size_t idy, G4double fac);
00152 inline G4double DerivativeXY(size_t idx, size_t idy, G4double fac);
00153
00154
00155 G4int operator==(const G4Physics2DVector &right) const ;
00156 G4int operator!=(const G4Physics2DVector &right) const ;
00157
00158 G4PhysicsVectorType type;
00159
00160 size_t numberOfXNodes;
00161 size_t numberOfYNodes;
00162
00163 G4Physics2DVectorCache* cache;
00164
00165 G4PV2DDataVector xVector;
00166 G4PV2DDataVector yVector;
00167 std::vector<G4PV2DDataVector*> value;
00168
00169 G4int verboseLevel;
00170 G4bool useBicubic;
00171 };
00172
00173 #include "G4Physics2DVector.icc"
00174
00175 #endif