Changeset 1315 for trunk/source/global/management/include
- Timestamp:
- Jun 18, 2010, 11:42:07 AM (15 years ago)
- Location:
- trunk/source/global/management/include
- Files:
-
- 13 edited
-
G4Allocator.hh (modified) (2 diffs)
-
G4LPhysicsFreeVector.hh (modified) (2 diffs)
-
G4LPhysicsFreeVector.icc (modified) (2 diffs)
-
G4PhysicsFreeVector.hh (modified) (2 diffs)
-
G4PhysicsLinearVector.hh (modified) (1 diff)
-
G4PhysicsLnVector.hh (modified) (1 diff)
-
G4PhysicsLogVector.hh (modified) (1 diff)
-
G4PhysicsOrderedFreeVector.hh (modified) (1 diff)
-
G4PhysicsOrderedFreeVector.icc (modified) (1 diff)
-
G4PhysicsVector.hh (modified) (8 diffs)
-
G4PhysicsVector.icc (modified) (7 diffs)
-
G4Pow.hh (modified) (4 diffs)
-
G4Version.hh (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/global/management/include/G4Allocator.hh
r1228 r1315 25 25 // 26 26 // 27 // $Id: G4Allocator.hh,v 1. 19 2009/10/29 16:01:28gcosmo Exp $28 // GEANT4 tag $Name: geant4-09-0 3$27 // $Id: G4Allocator.hh,v 1.20 2010/03/30 08:17:24 gcosmo Exp $ 28 // GEANT4 tag $Name: geant4-09-04-beta-cand-01 $ 29 29 // 30 30 // … … 137 137 // Rebind allocator to type U 138 138 139 private:140 141 139 G4AllocatorPool mem; 142 140 // Pool of elements of sizeof(Type) -
trunk/source/global/management/include/G4LPhysicsFreeVector.hh
r1228 r1315 25 25 // 26 26 // 27 // $Id: G4LPhysicsFreeVector.hh,v 1.1 1 2008/09/22 08:26:33 gcosmoExp $28 // GEANT4 tag $Name: geant4-09-0 3$27 // $Id: G4LPhysicsFreeVector.hh,v 1.14 2010/05/28 05:13:43 kurasige Exp $ 28 // GEANT4 tag $Name: geant4-09-04-beta-cand-01 $ 29 29 // 30 30 // … … 74 74 G4int GetVerboseLevel(G4int); 75 75 76 G4double GetLastEnergy();77 78 size_t GetLastBin();79 80 76 void DumpValues(); 81 77 -
trunk/source/global/management/include/G4LPhysicsFreeVector.icc
r1193 r1315 25 25 // 26 26 // 27 // $Id: G4LPhysicsFreeVector.icc,v 1.1 4 2009/06/25 10:05:26 vnivanchExp $28 // GEANT4 tag $Name: g lobal-V09-02-10$27 // $Id: G4LPhysicsFreeVector.icc,v 1.17 2010/05/28 05:13:43 kurasige Exp $ 28 // GEANT4 tag $Name: geant4-09-04-beta-cand-01 $ 29 29 // 30 30 // … … 68 68 } 69 69 70 inline71 G4double G4LPhysicsFreeVector::GetLastEnergy()72 {73 return lastEnergy;74 }75 76 inline77 size_t G4LPhysicsFreeVector::GetLastBin()78 {79 return lastBin;80 }81 70 82 71 inline -
trunk/source/global/management/include/G4PhysicsFreeVector.hh
r1228 r1315 25 25 // 26 26 // 27 // $Id: G4PhysicsFreeVector.hh,v 1.1 3 2009/06/25 10:05:26 vnivanchExp $28 // GEANT4 tag $Name: geant4-09-0 3$27 // $Id: G4PhysicsFreeVector.hh,v 1.15 2010/05/28 05:13:43 kurasige Exp $ 28 // GEANT4 tag $Name: geant4-09-04-beta-cand-01 $ 29 29 // 30 30 // … … 76 76 // the same vector length. 77 77 78 ~G4PhysicsFreeVector();78 virtual ~G4PhysicsFreeVector(); 79 79 // Destructor 80 80 -
trunk/source/global/management/include/G4PhysicsLinearVector.hh
r1228 r1315 25 25 // 26 26 // 27 // $Id: G4PhysicsLinearVector.hh,v 1.1 1 2008/09/22 11:37:09 vnivanchExp $28 // GEANT4 tag $Name: geant4-09-0 3$27 // $Id: G4PhysicsLinearVector.hh,v 1.13 2010/05/28 05:13:43 kurasige Exp $ 28 // GEANT4 tag $Name: geant4-09-04-beta-cand-01 $ 29 29 // 30 30 // -
trunk/source/global/management/include/G4PhysicsLnVector.hh
r1228 r1315 25 25 // 26 26 // 27 // $Id: G4PhysicsLnVector.hh,v 1.1 3 2008/09/22 11:37:09 vnivanchExp $28 // GEANT4 tag $Name: geant4-09-0 3$27 // $Id: G4PhysicsLnVector.hh,v 1.15 2010/05/28 05:13:43 kurasige Exp $ 28 // GEANT4 tag $Name: geant4-09-04-beta-cand-01 $ 29 29 // 30 30 // -
trunk/source/global/management/include/G4PhysicsLogVector.hh
r1228 r1315 25 25 // 26 26 // 27 // $Id: G4PhysicsLogVector.hh,v 1.1 3 2008/09/22 08:26:33 gcosmoExp $28 // GEANT4 tag $Name: geant4-09-0 3$27 // $Id: G4PhysicsLogVector.hh,v 1.15 2010/05/28 05:13:43 kurasige Exp $ 28 // GEANT4 tag $Name: geant4-09-04-beta-cand-01 $ 29 29 // 30 30 // -
trunk/source/global/management/include/G4PhysicsOrderedFreeVector.hh
r1228 r1315 25 25 // 26 26 // 27 // $Id: G4PhysicsOrderedFreeVector.hh,v 1.1 2 2009/06/25 10:05:26 vnivanchExp $28 // GEANT4 tag $Name: geant4-09-0 3$27 // $Id: G4PhysicsOrderedFreeVector.hh,v 1.14 2010/05/28 05:13:43 kurasige Exp $ 28 // GEANT4 tag $Name: geant4-09-04-beta-cand-01 $ 29 29 // 30 30 //////////////////////////////////////////////////////////////////////// -
trunk/source/global/management/include/G4PhysicsOrderedFreeVector.icc
r1193 r1315 25 25 // 26 26 // 27 // $Id: G4PhysicsOrderedFreeVector.icc,v 1. 9 2009/06/25 10:05:26 vnivanchExp $28 // GEANT4 tag $Name: g lobal-V09-02-10$27 // $Id: G4PhysicsOrderedFreeVector.icc,v 1.11 2010/05/28 05:13:43 kurasige Exp $ 28 // GEANT4 tag $Name: geant4-09-04-beta-cand-01 $ 29 29 // 30 30 //////////////////////////////////////////////////////////////////////// -
trunk/source/global/management/include/G4PhysicsVector.hh
r1228 r1315 25 25 // 26 26 // 27 // $Id: G4PhysicsVector.hh,v 1. 25 2009/11/04 11:32:43 vnivanchExp $28 // GEANT4 tag $Name: geant4-09-0 3$27 // $Id: G4PhysicsVector.hh,v 1.31 2010/05/28 05:13:43 kurasige Exp $ 28 // GEANT4 tag $Name: geant4-09-04-beta-cand-01 $ 29 29 // 30 30 // … … 53 53 // 11 May 2009, V.Ivanchenko : Added ComputeSecondDerivatives 54 54 // 19 Jun. 2009, V.Ivanchenko : Removed hidden bin 55 // 55 // 22 Dec. 2009 H.Kurashige : Use pointers to G4PVDataVector 56 // 04 May. 2010 H.Kurashige : Use G4PhysicsVectorCache 57 // 28 May 2010 H.Kurashige : Stop using pointers to G4PVDataVector 56 58 //--------------------------------------------------------------- 57 59 … … 65 67 #include <fstream> 66 68 69 #include "G4PhysicsVectorCache.hh" 67 70 #include "G4PhysicsVectorType.hh" 71 72 typedef std::vector<G4double> G4PVDataVector; 68 73 69 74 class G4PhysicsVector … … 86 91 // destructor 87 92 88 inlineG4double Value(G4double theEnergy);93 G4double Value(G4double theEnergy); 89 94 // Get the cross-section/energy-loss value corresponding to the 90 95 // given energy. An appropriate interpolation is used to calculate … … 175 180 friend std::ostream& operator<<(std::ostream&, const G4PhysicsVector&); 176 181 182 183 G4double GetLastEnergy() const; 184 G4double GetLastValue() const; 185 size_t GetLastBin() const; 186 // Get cache values 187 177 188 protected: 178 189 … … 186 197 protected: 187 198 188 typedef std::vector<G4double> G4PVDataVector;189 190 199 G4PhysicsVectorType type; // The type of PhysicsVector (enumerator) 191 200 … … 195 204 size_t numberOfNodes; 196 205 197 G4double lastEnergy; // Cache the last input value 198 G4double lastValue; // Cache the last output value 199 size_t lastBin; // Cache the last bin location 200 201 G4PVDataVector dataVector; // Vector to keep the crossection/energyloss 202 G4PVDataVector binVector; // Vector to keep energy 203 G4PVDataVector secDerivative; // Vector to keep second derivatives 206 G4PhysicsVectorCache* cache; 207 208 G4PVDataVector dataVector; // Vector to keep the crossection/energyloss 209 G4PVDataVector binVector; // Vector to keep energy 210 G4PVDataVector secDerivative; // Vector to keep second derivatives 204 211 205 212 private: … … 207 214 G4bool SplinePossible(); 208 215 209 inline G4double LinearInterpolation( );216 inline G4double LinearInterpolation(G4int lastBin); 210 217 // Linear interpolation function 211 inline G4double SplineInterpolation( );218 inline G4double SplineInterpolation(G4int lastBin); 212 219 // Spline interpolation function 213 220 214 inline void Interpolation( );221 inline void Interpolation(G4int lastBin); 215 222 216 223 G4String comment; -
trunk/source/global/management/include/G4PhysicsVector.icc
r1193 r1315 25 25 // 26 26 // 27 // $Id: G4PhysicsVector.icc,v 1.2 3 2009/11/18 11:42:03 vnivanchExp $28 // GEANT4 tag $Name: g lobal-V09-02-10$27 // $Id: G4PhysicsVector.icc,v 1.28 2010/05/28 05:13:43 kurasige Exp $ 28 // GEANT4 tag $Name: geant4-09-04-beta-cand-01 $ 29 29 // 30 30 // … … 44 44 45 45 inline 46 G4double G4PhysicsVector::GetLastEnergy() const 47 { 48 return cache->lastEnergy; 49 } 50 51 inline 52 G4double G4PhysicsVector::GetLastValue() const 53 { 54 return cache->lastValue; 55 } 56 57 inline 58 size_t G4PhysicsVector::GetLastBin() const 59 { 60 return cache->lastBin; 61 } 62 63 inline 46 64 G4double G4PhysicsVector::operator[](const size_t binNumber) const 47 65 { 66 return dataVector[binNumber]; 67 } 68 69 //--------------------------------------------------------------- 70 71 inline 72 G4double G4PhysicsVector::operator()(const size_t binNumber) const 73 { 48 74 return dataVector[binNumber]; 49 75 } … … 52 78 53 79 inline 54 G4double G4PhysicsVector::operator()(const size_t binNumber) const55 {56 return dataVector[binNumber];57 }58 59 //---------------------------------------------------------------60 61 inline62 80 G4double G4PhysicsVector::Energy(const size_t binNumber) const 63 81 { … … 76 94 77 95 inline 78 G4double G4PhysicsVector::LinearInterpolation() 96 G4double G4PhysicsVector::GetValue(G4double theEnergy, G4bool&) 97 { 98 return Value(theEnergy); 99 } 100 101 //------------------------------------------------ 102 103 inline 104 G4double G4PhysicsVector::LinearInterpolation(G4int lastBin) 79 105 { 80 106 // Linear interpolation is used to get the value. If the give energy … … 84 110 // numberOfBin-1. 85 111 86 G4double intplFactor = ( lastEnergy-binVector[lastBin])87 / (binVector[lastBin +1]-binVector[lastBin]); // Interpolationfactor112 G4double intplFactor = (cache->lastEnergy-binVector[lastBin]) 113 / (binVector[lastBin + 1]-binVector[lastBin]); // Interpol. factor 88 114 89 115 return dataVector[lastBin] + 90 ( dataVector[lastBin +1]-dataVector[lastBin] ) * intplFactor;91 } 92 93 //--------------------------------------------------------------- 94 95 inline 96 G4double G4PhysicsVector::SplineInterpolation( )116 ( dataVector[lastBin + 1]-dataVector[lastBin] ) * intplFactor; 117 } 118 119 //--------------------------------------------------------------- 120 121 inline 122 G4double G4PhysicsVector::SplineInterpolation(G4int lastBin) 97 123 { 98 124 // Spline interpolation is used to get the value. If the give energy … … 106 132 // check bin value 107 133 G4double x1 = binVector[lastBin]; 108 G4double x2 = binVector[lastBin +1];134 G4double x2 = binVector[lastBin + 1]; 109 135 G4double delta = x2 - x1; 110 136 111 G4double a = (x2 - lastEnergy)/delta;112 G4double b = ( lastEnergy - x1)/delta;137 G4double a = (x2 - cache->lastEnergy)/delta; 138 G4double b = (cache->lastEnergy - x1)/delta; 113 139 114 140 // Final evaluation of cubic spline polynomial for return 115 141 G4double y1 = dataVector[lastBin]; 116 G4double y2 = dataVector[lastBin +1];142 G4double y2 = dataVector[lastBin + 1]; 117 143 118 144 G4double res = a*y1 + b*y2 + 119 145 ( (a*a*a - a)*secDerivative[lastBin] + 120 (b*b*b - b)*secDerivative[lastBin +1] )*delta*delta/6.0;146 (b*b*b - b)*secDerivative[lastBin + 1] )*delta*delta/6.0; 121 147 122 148 return res; … … 125 151 //--------------------------------------------------------------- 126 152 127 inline 128 G4double G4PhysicsVector::GetValue(G4double theEnergy, G4bool&) 129 { 130 return Value(theEnergy); 131 } 132 133 //--------------------------------------------------------------- 134 135 inline 136 G4double G4PhysicsVector::Value(G4double theEnergy) 137 { 138 // Use cache for speed up - check if the value 'theEnergy' is same as the 139 // last call. If it is same, then use the last bin location. Also the 140 // value 'theEnergy' lies between the last energy and low edge of of the 141 // bin of last call, then the last bin location is used. 142 143 if( theEnergy == lastEnergy ) { 144 145 } else if(theEnergy < lastEnergy && theEnergy >= binVector[lastBin]) { 146 lastEnergy = theEnergy; 147 Interpolation(); 148 149 } else if( theEnergy <= edgeMin ) { 150 lastBin = 0; 151 lastEnergy = edgeMin; 152 lastValue = dataVector[0]; 153 154 } else if( theEnergy >= edgeMax ){ 155 lastBin = numberOfNodes-2; 156 lastEnergy = edgeMax; 157 lastValue = dataVector[numberOfNodes-1]; 158 159 } else { 160 lastBin = FindBinLocation(theEnergy); 161 if(lastBin >= numberOfNodes-1) {lastBin = numberOfNodes-2;} 162 lastEnergy = theEnergy; 163 Interpolation(); 164 } 165 return lastValue; 166 } 167 168 //--------------------------------------------------------------- 169 170 inline 171 void G4PhysicsVector::Interpolation() 172 { 173 if(useSpline) { lastValue = SplineInterpolation(); } 174 else { lastValue = LinearInterpolation(); } 153 inline 154 void G4PhysicsVector::Interpolation(G4int lastBin) 155 { 156 if(useSpline) { cache->lastValue = SplineInterpolation(lastBin); } 157 else { cache->lastValue = LinearInterpolation(lastBin); } 175 158 } 176 159 -
trunk/source/global/management/include/G4Pow.hh
r1228 r1315 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4Pow.hh,v 1. 2 2009/07/03 11:35:07vnivanch Exp $27 // GEANT4 tag $Name: geant4-09-0 3$26 // $Id: G4Pow.hh,v 1.5 2010/05/28 08:18:03 vnivanch Exp $ 27 // GEANT4 tag $Name: geant4-09-04-beta-cand-01 $ 28 28 // 29 29 // … … 35 35 // 36 36 // Utility singleton class for the fast computation of log and pow 37 // functions 37 // functions. Integer argument should in the interval 0-255, no 38 // check is performed inside these methods for performance reasons. 39 // Computations with double arguments are fast for the interval 40 // 0.5-255.5, standard library is used in the opposite case 38 41 39 42 // Author: Vladimir Ivanchenko … … 109 112 inline G4double G4Pow::A13(G4double A) 110 113 { 111 const G4int maxZ = 256; 114 const G4double minA = 0.5000001; 115 const G4double maxA = 255.5; 112 116 113 117 G4double res; 114 G4int i = G4int(A + 0.5); 115 if((i >= 1) && (i < maxZ)) 118 if((A >= minA) && (A <= maxA)) 116 119 { 120 G4int i = G4int(A + 0.5); 117 121 G4double x = (1.0 - A/G4double(i))*onethird; 118 122 res = pz13[i]*(1.0 + x - x*x*(1.0 - 1.66666666*x)); … … 144 148 inline G4double G4Pow::logA(G4double A) 145 149 { 146 const G4int maxZ = 256; 150 const G4double minA = 0.5000001; 151 const G4double maxA = 255.5; 147 152 148 153 G4double res; 149 G4int i = G4int(A + 0.5); 150 if((i >= 1) && (i < maxZ)) 154 if((A >= minA) && (A <= maxA)) 151 155 { 156 G4int i = G4int(A + 0.5); 152 157 G4double x = 1.0 - A/G4double(i); 153 158 res = lz[i] + x*(1.0 - 0.5*x + onethird*x*x); -
trunk/source/global/management/include/G4Version.hh
r1228 r1315 25 25 // 26 26 // 27 // $Id: G4Version.hh,v 1.2 5 2009/11/24 13:51:02gcosmo Exp $28 // GEANT4 tag $Name: geant4-09-0 3$27 // $Id: G4Version.hh,v 1.27 2010/06/09 13:52:53 gcosmo Exp $ 28 // GEANT4 tag $Name: geant4-09-04-beta-cand-01 $ 29 29 // 30 30 // Version information … … 47 47 48 48 #ifndef G4VERSION_NUMBER 49 #define G4VERSION_NUMBER 9 3049 #define G4VERSION_NUMBER 940 50 50 #endif 51 51 52 52 #ifndef G4VERSION_TAG 53 #define G4VERSION_TAG "$Name: geant4-09-0 3$"53 #define G4VERSION_TAG "$Name: geant4-09-04-beta-cand-01 $" 54 54 #endif 55 55 … … 58 58 #include "G4String.hh" 59 59 60 static const G4String G4Version = "$Name: geant4-09-0 3$";61 static const G4String G4Date = "( 18-December-2009)";60 static const G4String G4Version = "$Name: geant4-09-04-beta-cand-01 $"; 61 static const G4String G4Date = "(25-June-2010)"; 62 62 63 63 #endif
Note:
See TracChangeset
for help on using the changeset viewer.
