Changeset 1315 for trunk/source/global
- Timestamp:
- Jun 18, 2010, 11:42:07 AM (14 years ago)
- Location:
- trunk/source/global
- Files:
-
- 41 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/global/HEPNumerics/test/G4IntegratorTest.cc
r1199 r1315 26 26 // 27 27 // $Id: G4IntegratorTest.cc,v 1.10 2006/08/21 12:24:32 gcosmo Exp $ 28 // GEANT4 tag $Name: geant4-09-0 2-ref-02$28 // GEANT4 tag $Name: geant4-09-04-beta-cand-01 $ 29 29 // 30 30 // Test program for G4Integrator class. The function std::exp(-x)*std::cos(x) is -
trunk/source/global/HEPNumerics/test/testChebyshev.cc
r1199 r1315 26 26 // 27 27 // $Id: testChebyshev.cc,v 1.6 2006/06/29 19:00:28 gunter Exp $ 28 // GEANT4 tag $Name: geant4-09-0 2-ref-02$28 // GEANT4 tag $Name: geant4-09-04-beta-cand-01 $ 29 29 // 30 30 // Test program for G4ChebyshevApproximation class. The function std::exp(-x)*std::cos(x) is -
trunk/source/global/HEPNumerics/test/testDataInterpolation.cc
r1199 r1315 26 26 // 27 27 // $Id: testDataInterpolation.cc,v 1.6 2006/06/29 19:00:31 gunter Exp $ 28 // GEANT4 tag $Name: geant4-09-0 2-ref-02$28 // GEANT4 tag $Name: geant4-09-04-beta-cand-01 $ 29 29 // 30 30 #include "G4ios.hh" -
trunk/source/global/HEPNumerics/test/testG4AnalyticalPolSolver.cc
r1199 r1315 26 26 // 27 27 // $Id: testG4AnalyticalPolSolver.cc,v 1.7 2006/06/29 19:00:33 gunter Exp $ 28 // GEANT4 tag $Name: geant4-09-0 2-ref-02$28 // GEANT4 tag $Name: geant4-09-04-beta-cand-01 $ 29 29 // 30 30 // Test program for G4AnalyticalPolSolver class. -
trunk/source/global/HEPNumerics/test/testG4PolynomialSolver.cc
r1199 r1315 26 26 // 27 27 // $Id: testG4PolynomialSolver.cc,v 1.6 2006/06/29 19:00:35 gunter Exp $ 28 // GEANT4 tag $Name: geant4-09-0 2-ref-02$28 // GEANT4 tag $Name: geant4-09-04-beta-cand-01 $ 29 29 // 30 30 #include "G4PolynomialSolver.hh" -
trunk/source/global/HEPNumerics/test/testGaussianQuadrature.cc
r1199 r1315 26 26 // 27 27 // $Id: testGaussianQuadrature.cc,v 1.6 2006/06/29 19:00:37 gunter Exp $ 28 // GEANT4 tag $Name: geant4-09-0 2-ref-02$28 // GEANT4 tag $Name: geant4-09-04-beta-cand-01 $ 29 29 // 30 30 // Test program for G4GaussianQuadrature class. The function std::exp(-x)*std::cos(x) is -
trunk/source/global/HEPNumerics/test/testIntegration.cc
r1199 r1315 26 26 // 27 27 // $Id: testIntegration.cc,v 1.6 2006/06/29 19:00:39 gunter Exp $ 28 // GEANT4 tag $Name: geant4-09-0 2-ref-02$28 // GEANT4 tag $Name: geant4-09-04-beta-cand-01 $ 29 29 // 30 30 // Test program for G4SimpleIntegration class. The function std::exp(-x)*std::cos(x) is -
trunk/source/global/HEPRandom/test/G4RandDistributionTest.cc
r1199 r1315 26 26 // 27 27 // $Id: G4RandDistributionTest.cc,v 1.5 2006/06/29 19:00:52 gunter Exp $ 28 // GEANT4 tag $Name: geant4-09-0 2-ref-02$28 // GEANT4 tag $Name: geant4-09-04-beta-cand-01 $ 29 29 // 30 30 // -
trunk/source/global/HEPRandom/test/G4RandGlobalTest.cc
r1199 r1315 26 26 // 27 27 // $Id: G4RandGlobalTest.cc,v 1.6 2006/06/29 19:00:55 gunter Exp $ 28 // GEANT4 tag $Name: geant4-09-0 2-ref-02$28 // GEANT4 tag $Name: geant4-09-04-beta-cand-01 $ 29 29 // 30 30 // -
trunk/source/global/HEPRandom/test/G4RandomDirectionTest.cc
r1199 r1315 26 26 // 27 27 // $Id: G4RandomDirectionTest.cc,v 1.1 2008/03/19 16:53:55 gcosmo Exp $ 28 // GEANT4 tag $Name: geant4-09-0 2-ref-02$28 // GEANT4 tag $Name: geant4-09-04-beta-cand-01 $ 29 29 // 30 30 // -
trunk/source/global/HEPRandom/test/G4ShootBitTest.cc
r1199 r1315 26 26 // 27 27 // $Id: G4ShootBitTest.cc,v 1.7 2006/06/29 19:00:58 gunter Exp $ 28 // GEANT4 tag $Name: geant4-09-0 2-ref-02$28 // GEANT4 tag $Name: geant4-09-04-beta-cand-01 $ 29 29 // 30 30 // -
trunk/source/global/History
r1228 r1315 1 $Id: History,v 1.2 34 2009/12/07 09:24:27 vnivanchExp $1 $Id: History,v 1.245 2010/06/09 13:54:13 gcosmo Exp $ 2 2 ------------------------------------------------------------------- 3 3 … … 18 18 ---------------------------------------------------------- 19 19 20 Dec 7, 2009 V.Ivanchenko (global-V09-02-12) 21 - G4PhysicsVector: (L.Pandola) fixed initialisation of lastEnergy to -DBL_MAX 22 allowing to have negative scale of energy 20 Jun 09, 2010 G.Cosmo (global-V09-03-08) 21 - Changed date for release 9.4-beta. 22 23 May 29, 2010 V.Ivantchenko (global-V09-03-07) 24 - More safe numerical computation of A13 and logA methods in G4Pow. 25 26 May 28, 2010 H.Kurasige 27 - Restored G4PVDataVector vectors in G4PhysicsVector owned by value instead 28 of pointers, as originally was before tag "global-V09-03-00". 29 30 May 05, 2010 G.Cosmo (global-V09-03-06) 31 - Move interpolation methods to inline in G4PhysicsVector. 32 - Some cleanup. 33 34 May 04, 2010 H.Kurashige (global-V09-03-05) 35 - Introduced G4PhysicsVectorCache, placeholder for cache R/W data in use 36 by G4PhysicsVector and derivates. 37 Modified G4PhysicsVector and G4LPhysicsFreeVector accordingly. 38 39 Apr 06, 2010 G.Cosmo (global-V09-03-04) 40 - Changed date for release 9.3.p01. 41 42 Mar 30, 2010 G.Cosmo (global-V09-03-03) 43 - Moved 'mem' pool in G4Allocator to public section, to allow for use of 44 allocator in vectors on Windows/C++. 45 46 Mar 23, 2010 V.Ivanchenko (global-V09-03-02) 47 - G4PhysicsLogVector, G4PhysicsLnVector, G4PhysicsLinearVector: preserve 48 values of 'edgeMin' and 'edgeMax' in constructors avoiding recomputation, 49 to avoid precision problem; fixes problem detected on Windows/VC++. 50 51 Feb 01, 2010 G.Cosmo (global-V09-03-01) 52 - Restored G4PVDataVector as typedef for optimisation; removed class files. 53 54 Dec 22, 2009 H.Kurashige (global-V09-03-00) 55 - Modified G4PhysicsVector to use pointers to G4PVDataVector instead of 56 holding it as static data. 57 58 Dec 07, 2009 L.Pandola, V.Ivanchenko (global-V09-02-12) 59 - G4PhysicsVector: fixed initialisation of 'lastEnergy' to -DBL_MAX 60 allowing to have negative scale of energy. 23 61 24 62 Nov 24, 2009 G.Cosmo (global-V09-02-11) -
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 -
trunk/source/global/management/src/G4LPhysicsFreeVector.cc
r1228 r1315 25 25 // 26 26 // 27 // $Id: G4LPhysicsFreeVector.cc,v 1.2 3 2009/06/25 10:05:26 vnivanchExp $28 // GEANT4 tag $Name: geant4-09-0 3$27 // $Id: G4LPhysicsFreeVector.cc,v 1.25 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/src/G4PhysicsFreeVector.cc
r1228 r1315 25 25 // 26 26 // 27 // $Id: G4PhysicsFreeVector.cc,v 1.1 3 2009/06/25 10:05:26 vnivanchExp $28 // GEANT4 tag $Name: geant4-09-0 3$27 // $Id: G4PhysicsFreeVector.cc,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 // … … 93 93 } 94 94 95 void G4PhysicsFreeVector::PutValue( size_t theBinNumber, G4double theBinValue, 95 void G4PhysicsFreeVector::PutValue( size_t theBinNumber, 96 G4double theBinValue, 96 97 G4double theDataValue ) 97 98 { -
trunk/source/global/management/src/G4PhysicsLinearVector.cc
r1228 r1315 25 25 // 26 26 // 27 // $Id: G4PhysicsLinearVector.cc,v 1.1 5 2009/06/25 10:05:26 vnivanchExp $28 // GEANT4 tag $Name: geant4-09-0 3$27 // $Id: G4PhysicsLinearVector.cc,v 1.18 2010/05/28 05:13:43 kurasige Exp $ 28 // GEANT4 tag $Name: geant4-09-04-beta-cand-01 $ 29 29 // 30 30 // … … 75 75 binVector.reserve(numberOfNodes); 76 76 77 for (size_t i=0; i<numberOfNodes; i++) 78 { 79 binVector.push_back( theEmin + i*dBin ); 80 dataVector.push_back(0.0); 81 } 77 binVector.push_back(theEmin); 78 dataVector.push_back(0.0); 79 80 for (size_t i=1; i<numberOfNodes-1; i++) 81 { 82 binVector.push_back( theEmin + i*dBin ); 83 dataVector.push_back(0.0); 84 } 85 binVector.push_back(theEmax); 86 dataVector.push_back(0.0); 82 87 83 88 edgeMin = binVector[0]; -
trunk/source/global/management/src/G4PhysicsLnVector.cc
r1228 r1315 25 25 // 26 26 // 27 // $Id: G4PhysicsLnVector.cc,v 1. 18 2009/06/25 10:05:26 vnivanchExp $28 // GEANT4 tag $Name: geant4-09-0 3$27 // $Id: G4PhysicsLnVector.cc,v 1.21 2010/05/28 05:13:43 kurasige Exp $ 28 // GEANT4 tag $Name: geant4-09-04-beta-cand-01 $ 29 29 // 30 30 // … … 75 75 binVector.reserve(numberOfNodes); 76 76 77 for (size_t i=0; i<numberOfNodes; i++) 78 { 79 binVector.push_back(std::exp((baseBin+i)*dBin)); 80 dataVector.push_back(0.0); 81 } 77 binVector.push_back(theEmin); 78 dataVector.push_back(0.0); 79 80 for (size_t i=1; i<numberOfNodes-1; i++) 81 { 82 binVector.push_back(std::exp((baseBin+i)*dBin)); 83 dataVector.push_back(0.0); 84 } 85 binVector.push_back(theEmax); 86 dataVector.push_back(0.0); 82 87 83 88 edgeMin = binVector[0]; -
trunk/source/global/management/src/G4PhysicsLogVector.cc
r1228 r1315 25 25 // 26 26 // 27 // $Id: G4PhysicsLogVector.cc,v 1.2 2 2009/06/25 10:05:26 vnivanchExp $28 // GEANT4 tag $Name: geant4-09-0 3$27 // $Id: G4PhysicsLogVector.cc,v 1.25 2010/05/28 05:13:43 kurasige Exp $ 28 // GEANT4 tag $Name: geant4-09-04-beta-cand-01 $ 29 29 // 30 30 // … … 82 82 static const G4double g4log10 = std::log(10.); 83 83 84 for (size_t i=0; i<numberOfNodes; i++) 85 { 86 binVector.push_back(std::exp(g4log10*(baseBin+i)*dBin)); 87 dataVector.push_back(0.0); 88 } 84 binVector.push_back(theEmin); 85 dataVector.push_back(0.0); 86 87 for (size_t i=1; i<numberOfNodes-1; i++) 88 { 89 binVector.push_back(std::exp(g4log10*(baseBin+i)*dBin)); 90 dataVector.push_back(0.0); 91 } 92 binVector.push_back(theEmax); 93 dataVector.push_back(0.0); 89 94 90 95 edgeMin = binVector[0]; -
trunk/source/global/management/src/G4PhysicsOrderedFreeVector.cc
r1228 r1315 25 25 // 26 26 // 27 // $Id: G4PhysicsOrderedFreeVector.cc,v 1.1 3 2009/06/25 10:05:26 vnivanchExp $28 // GEANT4 tag $Name: geant4-09-0 3$27 // $Id: G4PhysicsOrderedFreeVector.cc,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/src/G4PhysicsVector.cc
r1228 r1315 25 25 // 26 26 // 27 // $Id: G4PhysicsVector.cc,v 1.4 1 2009/12/07 09:21:27 vnivanchExp $28 // GEANT4 tag $Name: geant4-09-0 3$27 // $Id: G4PhysicsVector.cc,v 1.46 2010/05/28 05:13:43 kurasige Exp $ 28 // GEANT4 tag $Name: geant4-09-04-beta-cand-01 $ 29 29 // 30 30 // … … 49 49 // algorithm 50 50 // 19 Jun. 2009, V.Ivanchenko : removed hidden bin 51 // 17 Nov. 2009, H.Kurashige : use pointer for DataVector 52 // 04 May 2010 H.Kurashige : use G4PhyscisVectorCache 53 // 28 May 2010 H.Kurashige : Stop using pointers to G4PVDataVector 51 54 // -------------------------------------------------------------- 52 55 … … 59 62 : type(T_G4PhysicsVector), 60 63 edgeMin(0.), edgeMax(0.), numberOfNodes(0), 61 lastEnergy(-DBL_MAX), lastValue(0.), lastBin(0), useSpline(spline) 62 {} 64 useSpline(spline) 65 { 66 cache = new G4PhysicsVectorCache(); 67 } 63 68 64 69 // -------------------------------------------------------------- 65 70 66 71 G4PhysicsVector::~G4PhysicsVector() 67 {} 72 { 73 delete cache; cache =0; 74 } 68 75 69 76 // -------------------------------------------------------------- … … 71 78 G4PhysicsVector::G4PhysicsVector(const G4PhysicsVector& right) 72 79 { 80 cache = new G4PhysicsVectorCache(); 73 81 CopyData(right); 74 82 } … … 116 124 edgeMax = vec.edgeMax; 117 125 numberOfNodes = vec.numberOfNodes; 118 lastEnergy = vec.lastEnergy; 119 lastValue = vec.lastValue; 120 lastBin = vec.lastBin; 121 dataVector = vec.dataVector; 122 binVector = vec.binVector; 126 cache->lastEnergy = vec.GetLastEnergy(); 127 cache->lastValue = vec.GetLastValue(); 128 cache->lastBin = vec.GetLastBin(); 123 129 useSpline = vec.useSpline; 124 130 comment = vec.comment; 125 secDerivative = vec.secDerivative; 131 132 size_t i; 133 dataVector.clear(); 134 for(i=0; i<(vec.dataVector).size(); i++){ 135 dataVector.push_back( (vec.dataVector)[i] ); 136 } 137 binVector.clear(); 138 for(i=0; i<(vec.binVector).size(); i++){ 139 binVector.push_back( (vec.binVector)[i] ); 140 } 141 secDerivative.clear(); 142 for(i=0; i<(vec.secDerivative).size(); i++){ 143 secDerivative.push_back( (vec.secDerivative)[i] ); 144 } 126 145 } 127 146 … … 171 190 { 172 191 // clear properties; 173 lastEnergy=-DBL_MAX;174 lastValue =0.;175 lastBin =0;192 cache->lastEnergy=-DBL_MAX; 193 cache->lastValue =0.; 194 cache->lastBin =0; 176 195 dataVector.clear(); 177 196 binVector.clear(); … … 253 272 edgeMin *= factorE; 254 273 edgeMax *= factorE; 255 lastEnergy *= factorE;256 lastValue *= factorV;274 cache->lastEnergy = factorE*(cache->lastEnergy); 275 cache->lastValue = factorV*(cache->lastValue); 257 276 } 258 277 … … 293 312 { 294 313 sig = (binVector[i]-binVector[i-1]) / (binVector[i+1]-binVector[i-1]); 295 p = sig* secDerivative[i-1]+ 2.0;314 p = sig*(secDerivative[i-1]) + 2.0; 296 315 secDerivative[i] = (sig - 1.0)/p; 297 316 u[i] = (dataVector[i+1]-dataVector[i])/(binVector[i+1]-binVector[i]) … … 457 476 return out; 458 477 } 478 479 //--------------------------------------------------------------- 480 481 G4double G4PhysicsVector::Value(G4double theEnergy) 482 { 483 // Use cache for speed up - check if the value 'theEnergy' is same as the 484 // last call. If it is same, then use the last bin location. Also the 485 // value 'theEnergy' lies between the last energy and low edge of of the 486 // bin of last call, then the last bin location is used. 487 488 if( theEnergy == cache->lastEnergy ) { 489 490 } else if( theEnergy < cache->lastEnergy 491 && theEnergy >= binVector[cache->lastBin]) { 492 cache->lastEnergy = theEnergy; 493 Interpolation(cache->lastBin); 494 495 } else if( theEnergy <= edgeMin ) { 496 cache->lastBin = 0; 497 cache->lastEnergy = edgeMin; 498 cache->lastValue = dataVector[0]; 499 500 } else if( theEnergy >= edgeMax ){ 501 cache->lastBin = numberOfNodes-1; 502 cache->lastEnergy = edgeMax; 503 cache->lastValue = dataVector[cache->lastBin]; 504 505 } else { 506 cache->lastBin = FindBinLocation(theEnergy); 507 cache->lastEnergy = theEnergy; 508 Interpolation(cache->lastBin); 509 } 510 return cache->lastValue; 511 } 512 -
trunk/source/global/management/test/AllocVectorTest.cc
r1199 r1315 26 26 // 27 27 // $Id: AllocVectorTest.cc,v 1.2 2006/06/29 19:04:45 gunter Exp $ 28 // GEANT4 tag $Name: geant4-09-0 2-ref-02$28 // GEANT4 tag $Name: geant4-09-04-beta-cand-01 $ 29 29 // 30 30 // -
trunk/source/global/management/test/AllocatorTest.cc
r1199 r1315 26 26 // 27 27 // $Id: AllocatorTest.cc,v 1.2 2006/06/29 19:04:47 gunter Exp $ 28 // GEANT4 tag $Name: geant4-09-0 2-ref-02$28 // GEANT4 tag $Name: geant4-09-04-beta-cand-01 $ 29 29 // 30 30 // -
trunk/source/global/management/test/DeallocatorTest.cc
r1199 r1315 26 26 // 27 27 // $Id: DeallocatorTest.cc,v 1.3 2006/06/29 19:04:49 gunter Exp $ 28 // GEANT4 tag $Name: geant4-09-0 2-ref-02$28 // GEANT4 tag $Name: geant4-09-04-beta-cand-01 $ 29 29 // 30 30 // -
trunk/source/global/management/test/G4UnitsTest.cc
r1199 r1315 26 26 // 27 27 // $Id: G4UnitsTest.cc,v 1.6 2006/06/29 19:04:53 gunter Exp $ 28 // GEANT4 tag $Name: geant4-09-0 2-ref-02$28 // GEANT4 tag $Name: geant4-09-04-beta-cand-01 $ 29 29 // 30 30 // -
trunk/source/global/management/test/LimitsTest.cc
r1199 r1315 26 26 // 27 27 // $Id: LimitsTest.cc,v 1.2 2006/06/29 19:04:55 gunter Exp $ 28 // GEANT4 tag $Name: geant4-09-0 2-ref-02$28 // GEANT4 tag $Name: geant4-09-04-beta-cand-01 $ 29 29 // 30 30 // -
trunk/source/global/management/test/OrderedTableTest.cc
r1199 r1315 26 26 // 27 27 // $Id: OrderedTableTest.cc,v 1.7 2006/06/29 19:04:58 gunter Exp $ 28 // GEANT4 tag $Name: geant4-09-0 2-ref-02$28 // GEANT4 tag $Name: geant4-09-04-beta-cand-01 $ 29 29 // 30 30 // -
trunk/source/global/management/test/PhysicsTableTest.cc
r1199 r1315 26 26 // 27 27 // $Id: PhysicsTableTest.cc,v 1.6 2006/06/29 19:05:00 gunter Exp $ 28 // GEANT4 tag $Name: geant4-09-0 2-ref-02$28 // GEANT4 tag $Name: geant4-09-04-beta-cand-01 $ 29 29 // 30 30 // -
trunk/source/global/management/test/TimerTest.cc
r1199 r1315 26 26 // 27 27 // $Id: TimerTest.cc,v 1.2 2006/06/29 19:05:02 gunter Exp $ 28 // GEANT4 tag $Name: geant4-09-0 2-ref-02$28 // GEANT4 tag $Name: geant4-09-04-beta-cand-01 $ 29 29 // 30 30 // -
trunk/source/global/management/test/testPhysicsOrderedFreeVector.cc
r1199 r1315 26 26 // 27 27 // $Id: testPhysicsOrderedFreeVector.cc,v 1.6 2006/06/29 19:05:05 gunter Exp $ 28 // GEANT4 tag $Name: geant4-09-0 2-ref-02$28 // GEANT4 tag $Name: geant4-09-04-beta-cand-01 $ 29 29 // 30 30 #include "globals.hh"
Note: See TracChangeset
for help on using the changeset viewer.