Changeset 921 for trunk/source/global/management
- Timestamp:
- Feb 16, 2009, 10:14:30 AM (15 years ago)
- Location:
- trunk/source/global/management
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/global/management/include/G4LPhysicsFreeVector.hh
r850 r921 25 25 // 26 26 // 27 // $Id: G4LPhysicsFreeVector.hh,v 1.1 0 2008/04/07 14:18:57gcosmo Exp $28 // GEANT4 tag $Name: HEAD$27 // $Id: G4LPhysicsFreeVector.hh,v 1.11 2008/09/22 08:26:33 gcosmo Exp $ 28 // GEANT4 tag $Name: geant4-09-02-cand-01 $ 29 29 // 30 30 // … … 62 62 ~G4LPhysicsFreeVector(); 63 63 64 G4LPhysicsFreeVector(const G4LPhysicsFreeVector&); 65 G4LPhysicsFreeVector& operator=(const G4LPhysicsFreeVector&); 66 // Copy constructor and assignment operator. 67 64 68 void PutValues(size_t binNumber, G4double binValue, G4double dataValue); 65 69 // G4PhysicsVector has PutValue() but it is inconvenient. -
trunk/source/global/management/include/G4LPhysicsFreeVector.icc
r850 r921 25 25 // 26 26 // 27 // $Id: G4LPhysicsFreeVector.icc,v 1.1 1 2008/09/06 19:52:16 vnivanchExp $28 // GEANT4 tag $Name: HEAD$27 // $Id: G4LPhysicsFreeVector.icc,v 1.13 2008/09/22 08:26:33 gcosmo Exp $ 28 // GEANT4 tag $Name: geant4-09-02-cand-01 $ 29 29 // 30 30 // … … 40 40 // 41 41 // F.W. Jones, TRIUMF, 04-JUN-96 42 // 05 Sep. 2008, V.Ivanchenko : added protections for zero-length vector43 42 // -------------------------------------------------------------------------- 44 43 … … 49 48 // Want to simultaneously fill the bin and data vectors. 50 49 { 51 if(binNumber <= numberOfBin) {52 binVector[binNumber] = binValue;53 dataVector[binNumber]= dataValue;54 if(0 == binNumber) edgeMin = binValue;55 else if( numberOfBin - 1 == binNumber) edgeMax = binValue;56 }50 binVector[binNumber] = binValue; 51 dataVector[binNumber] = dataValue; 52 if(binNumber == 0) 53 { edgeMin = binValue; } 54 else if( numberOfBin - 1 == binNumber) 55 { edgeMax = binValue; } 57 56 } 58 57 -
trunk/source/global/management/include/G4PhysicsFreeVector.hh
r850 r921 25 25 // 26 26 // 27 // $Id: G4PhysicsFreeVector.hh,v 1.1 0 2006/06/29 19:02:18 gunterExp $28 // GEANT4 tag $Name: HEAD$27 // $Id: G4PhysicsFreeVector.hh,v 1.12 2008/09/22 14:49:57 gcosmo Exp $ 28 // GEANT4 tag $Name: geant4-09-02-cand-01 $ 29 29 // 30 30 // -
trunk/source/global/management/include/G4PhysicsLinearVector.hh
r850 r921 25 25 // 26 26 // 27 // $Id: G4PhysicsLinearVector.hh,v 1.1 0 2006/06/29 19:02:21 gunterExp $28 // GEANT4 tag $Name: HEAD$27 // $Id: G4PhysicsLinearVector.hh,v 1.11 2008/09/22 11:37:09 vnivanch Exp $ 28 // GEANT4 tag $Name: geant4-09-02-cand-01 $ 29 29 // 30 30 // … … 73 73 // Destructor 74 74 75 G4PhysicsLinearVector(const G4PhysicsLinearVector&); 76 G4PhysicsLinearVector& operator=(const G4PhysicsLinearVector&); 77 // Copy constructor and assignment operator. 78 75 79 G4bool Retrieve(std::ifstream& fIn, G4bool ascii); 76 80 -
trunk/source/global/management/include/G4PhysicsLnVector.hh
r850 r921 25 25 // 26 26 // 27 // $Id: G4PhysicsLnVector.hh,v 1.1 2 2006/06/29 19:02:23 gunterExp $28 // GEANT4 tag $Name: HEAD$27 // $Id: G4PhysicsLnVector.hh,v 1.13 2008/09/22 11:37:09 vnivanch Exp $ 28 // GEANT4 tag $Name: geant4-09-02-cand-01 $ 29 29 // 30 30 // … … 70 70 // Destructor. 71 71 72 G4PhysicsLnVector(const G4PhysicsLnVector&); 73 G4PhysicsLnVector& operator=(const G4PhysicsLnVector&); 74 // Copy constructor and assignment operator. 75 72 76 G4bool Retrieve(std::ifstream& fIn, G4bool ascii); 73 77 // To retrieve persistent data from file stream. -
trunk/source/global/management/include/G4PhysicsLogVector.hh
r850 r921 25 25 // 26 26 // 27 // $Id: G4PhysicsLogVector.hh,v 1.1 1 2006/06/29 19:02:25 gunterExp $28 // GEANT4 tag $Name: HEAD$27 // $Id: G4PhysicsLogVector.hh,v 1.13 2008/09/22 08:26:33 gcosmo Exp $ 28 // GEANT4 tag $Name: geant4-09-02-cand-01 $ 29 29 // 30 30 // … … 75 75 // Destructor 76 76 77 G4PhysicsLogVector(const G4PhysicsLogVector&); 78 G4PhysicsLogVector& operator=(const G4PhysicsLogVector&); 79 // Copy constructor and assignment operator. 80 77 81 G4bool Retrieve(std::ifstream& fIn, G4bool ascii); 78 82 // To retrieve persistent data from file stream. 79 83 80 84 protected: 81 85 -
trunk/source/global/management/include/G4PhysicsOrderedFreeVector.hh
r850 r921 25 25 // 26 26 // 27 // $Id: G4PhysicsOrderedFreeVector.hh,v 1. 9 2006/06/29 19:02:28 gunterExp $28 // GEANT4 tag $Name: HEAD$27 // $Id: G4PhysicsOrderedFreeVector.hh,v 1.11 2008/09/22 14:49:57 gcosmo Exp $ 28 // GEANT4 tag $Name: geant4-09-02-cand-01 $ 29 29 // 30 30 //////////////////////////////////////////////////////////////////////// -
trunk/source/global/management/include/G4PhysicsVector.hh
r850 r921 25 25 // 26 26 // 27 // $Id: G4PhysicsVector.hh,v 1.1 7 2008/04/07 14:18:57gcosmo Exp $28 // GEANT4 tag $Name: HEAD$27 // $Id: G4PhysicsVector.hh,v 1.18 2008/09/22 08:26:33 gcosmo Exp $ 28 // GEANT4 tag $Name: geant4-09-02-cand-01 $ 29 29 // 30 30 // … … 144 144 // Find the bin# in which theEnergy belongs - pure virtual function 145 145 146 void DeleteData(); 147 void CopyData(const G4PhysicsVector& vec); 148 // Internal methods for allowing copy of objects 149 150 protected: 151 146 152 typedef std::vector<G4double> G4PVDataVector; 147 153 -
trunk/source/global/management/include/G4PhysicsVector.icc
r850 r921 25 25 // 26 26 // 27 // $Id: G4PhysicsVector.icc,v 1.1 4 2008/09/05 18:04:45 vnivanchExp $28 // GEANT4 tag $Name: HEAD$27 // $Id: G4PhysicsVector.icc,v 1.17 2008/09/22 08:26:33 gcosmo Exp $ 28 // GEANT4 tag $Name: geant4-09-02-cand-01 $ 29 29 // 30 30 // … … 41 41 // energy scale, for example like 'log', 'linear', 'free', etc. 42 42 // 43 // Modified:44 // 05 Sep. 2008, V.Ivanchenko : added protections for zero-length vector45 43 //--------------------------------------------------------------- 46 44 … … 127 125 if( theEnergy == lastEnergy ) { 128 126 129 } else if( theEnergy <= edgeMin ) {130 lastBin = 0;131 lastEnergy = theEnergy;132 lastValue = dataVector[0];133 134 127 } else if(theEnergy < lastEnergy && theEnergy >= binVector[lastBin]) { 135 128 lastEnergy = theEnergy; 136 129 Interpolation(); 130 131 } else if( theEnergy <= edgeMin ) { 132 lastBin = 0; 133 lastEnergy = edgeMin; 134 lastValue = dataVector[0]; 137 135 138 136 } else if(theEnergy < lastEnergy && theEnergy >= binVector[lastBin-1]) { … … 168 166 void G4PhysicsVector::PutValue(size_t binNumber, G4double theValue) 169 167 { 170 if(binNumber < numberOfBin) { 171 dataVector[binNumber] = theValue; 172 173 // Fill the bin which is hidden to user with theValue. This is to 174 // handle correctly when Energy=theEmax in getValue. 175 176 if(binNumber==numberOfBin-1) { dataVector[binNumber+1] = theValue; } 177 } 168 dataVector[binNumber] = theValue; 169 170 // Fill the bin which is hidden to user with theValue. This is to 171 // handle correctly when Energy=theEmax in getValue. 172 173 if(binNumber==numberOfBin-1) { dataVector[binNumber+1] = theValue; } 178 174 } 179 175 -
trunk/source/global/management/include/G4Version.hh
r850 r921 25 25 // 26 26 // 27 // $Id: G4Version.hh,v 1.1 6 2008/06/26 06:38:51gcosmo Exp $28 // GEANT4 tag $Name: HEAD$27 // $Id: G4Version.hh,v 1.17 2008/12/02 09:15:58 gcosmo Exp $ 28 // GEANT4 tag $Name: geant4-09-02-cand-01 $ 29 29 // 30 30 // Version information … … 51 51 52 52 #ifndef G4VERSION_TAG 53 #define G4VERSION_TAG "$Name: HEAD$"53 #define G4VERSION_TAG "$Name: geant4-09-02-cand-01 $" 54 54 #endif 55 55 … … 58 58 #include "G4String.hh" 59 59 60 static const G4String G4Version = "$Name: HEAD$";61 static const G4String G4Date = "( 4-July-2008)";60 static const G4String G4Version = "$Name: geant4-09-02-cand-01 $"; 61 static const G4String G4Date = "(19-December-2008)"; 62 62 63 63 #endif -
trunk/source/global/management/src/G4LPhysicsFreeVector.cc
r850 r921 25 25 // 26 26 // 27 // $Id: G4LPhysicsFreeVector.cc,v 1. 17 2008/09/06 19:52:16 vnivanchExp $28 // GEANT4 tag $Name: HEAD$27 // $Id: G4LPhysicsFreeVector.cc,v 1.22 2008/09/22 08:26:33 gcosmo Exp $ 28 // GEANT4 tag $Name: geant4-09-02-cand-01 $ 29 29 // 30 30 // … … 36 36 // F.W. Jones, TRIUMF, 04-JUN-96 37 37 // 38 // 27-MAR-97 FWJ: first version for Alpha release39 // 05-SEP-2008, V.Ivanchenko : added protections for zero-length vector40 38 // -------------------------------------------------------------------- 41 39 … … 49 47 : G4PhysicsVector(), verboseLevel(0) 50 48 { 51 type = T_G4LPhysicsFreeVector;49 type = T_G4LPhysicsFreeVector; 52 50 } 53 51 … … 59 57 : G4PhysicsVector(), verboseLevel(0) 60 58 { 61 type = T_G4LPhysicsFreeVector;59 type = T_G4LPhysicsFreeVector; 62 60 63 numberOfBin = nbin; 64 if(nbin > 0) { 65 binVector.resize(nbin+1); 66 dataVector.resize(nbin+1); 67 edgeMin = binmin; 68 edgeMax = binmax; 69 for (size_t i=0; i<=numberOfBin; i++) { 70 binVector[i] = binmin; 71 dataVector[i]= 0.0; 72 } 73 } 61 edgeMin = binmin; 62 edgeMax = binmax; 63 numberOfBin = nbin; 64 binVector.reserve(nbin+1); 65 dataVector.reserve(nbin+1); 66 for (size_t i=0; i<=numberOfBin; i++) 67 { 68 binVector.push_back(0.0); 69 dataVector.push_back(0.0); 70 } 74 71 } 75 72 … … 78 75 G4LPhysicsFreeVector::~G4LPhysicsFreeVector() 79 76 { 77 } 78 79 // -------------------------------------------------------------------- 80 81 G4LPhysicsFreeVector::G4LPhysicsFreeVector(const G4LPhysicsFreeVector& right) 82 : G4PhysicsVector(right) 83 { 84 verboseLevel = right.verboseLevel; 85 } 86 87 // -------------------------------------------------------------------- 88 89 G4LPhysicsFreeVector& 90 G4LPhysicsFreeVector::operator=(const G4LPhysicsFreeVector& right) 91 { 92 // Check assignment to self 93 // 94 if(this == &right) { return *this; } 95 96 DeleteData(); 97 CopyData(right); 98 99 verboseLevel = right.verboseLevel; 100 return *this; 80 101 } 81 102 -
trunk/source/global/management/src/G4PhysicsFreeVector.cc
r850 r921 25 25 // 26 26 // 27 // $Id: G4PhysicsFreeVector.cc,v 1.1 0 2006/06/29 19:04:10 gunterExp $28 // GEANT4 tag $Name: HEAD$27 // $Id: G4PhysicsFreeVector.cc,v 1.12 2008/09/22 14:49:57 gcosmo Exp $ 28 // GEANT4 tag $Name: geant4-09-02-cand-01 $ 29 29 // 30 30 // … … 47 47 48 48 49 G4PhysicsFreeVector::G4PhysicsFreeVector() 49 G4PhysicsFreeVector::G4PhysicsFreeVector() 50 : G4PhysicsVector() 50 51 { 51 edgeMin = 0.0;52 edgeMax = 0.0;53 numberOfBin = 0;54 52 type = T_G4PhysicsFreeVector; 55 53 } 56 54 57 58 55 G4PhysicsFreeVector::G4PhysicsFreeVector(size_t theNbin) 56 : G4PhysicsVector() 59 57 { 60 58 type = T_G4PhysicsFreeVector; … … 71 69 dataVector.push_back(0.0); 72 70 } 73 74 edgeMin = 0.;75 edgeMax = 0.;76 77 lastBin = INT_MAX;78 lastEnergy = -DBL_MAX;79 lastValue = DBL_MAX;80 71 } 81 82 72 83 73 G4PhysicsFreeVector::G4PhysicsFreeVector(const G4DataVector& theBinVector, … … 111 101 edgeMin = binVector[0]; 112 102 edgeMax = binVector[numberOfBin-1]; 113 114 lastBin = INT_MAX;115 lastEnergy = -DBL_MAX;116 lastValue = DBL_MAX;117 103 } 118 104 119 120 G4PhysicsFreeVector::~G4PhysicsFreeVector(){} 121 105 G4PhysicsFreeVector::~G4PhysicsFreeVector() 106 { 107 } 122 108 123 109 void G4PhysicsFreeVector::PutValue( size_t theBinNumber, G4double theBinValue, -
trunk/source/global/management/src/G4PhysicsLinearVector.cc
r850 r921 25 25 // 26 26 // 27 // $Id: G4PhysicsLinearVector.cc,v 1.1 2 2006/06/29 19:04:13 gunterExp $28 // GEANT4 tag $Name: HEAD$27 // $Id: G4PhysicsLinearVector.cc,v 1.14 2008/09/22 14:49:57 gcosmo Exp $ 28 // GEANT4 tag $Name: geant4-09-02-cand-01 $ 29 29 // 30 30 // … … 34 34 // G4PhysicsLinearVector.cc 35 35 // 36 // History: 37 // 02 Dec. 1995, G.Cosmo : Structure created based on object model 38 // 15 Feb. 1996, K.Amako : Implemented the 1st version 39 // 01 Jul. 1996, K.Amako : Cache mechanism and hidden bin from the 40 // user introduced. 41 // 26 Sep. 1996, K.Amako : Constructor with only 'bin size' added. 42 // 11 Nov. 2000, H.Kurashige : use STL vector for dataVector and binVector 43 // 9 Mar. 2001, H.Kurashige : add PhysicsVector type and Retrieve 36 // 15 Feb 1996 - K.Amako : 1st version 44 37 // 45 38 //-------------------------------------------------------------------- … … 48 41 49 42 G4PhysicsLinearVector::G4PhysicsLinearVector() 50 : dBin(0.), baseBin(0.)43 : G4PhysicsVector(), dBin(0.), baseBin(0.) 51 44 { 52 edgeMin = 0.0;53 edgeMax = 0.0;54 numberOfBin = 0;55 45 type = T_G4PhysicsLinearVector; 56 46 } 57 47 58 48 G4PhysicsLinearVector::G4PhysicsLinearVector(size_t theNbin) 59 : dBin(0.), baseBin(0.)49 : G4PhysicsVector(), dBin(0.), baseBin(0.) 60 50 { 61 51 type = T_G4PhysicsLinearVector; … … 68 58 numberOfBin = theNbin; 69 59 70 edgeMin = 0.;71 edgeMax = 0.;72 73 lastBin = INT_MAX;74 lastEnergy = -DBL_MAX;75 lastValue = DBL_MAX;76 77 60 for (size_t i=0; i<=numberOfBin; i++) 78 61 { … … 84 67 G4PhysicsLinearVector::G4PhysicsLinearVector(G4double theEmin, 85 68 G4double theEmax, size_t theNbin) 86 : dBin((theEmax-theEmin)/theNbin), 69 : G4PhysicsVector(), 70 dBin((theEmax-theEmin)/theNbin), 87 71 baseBin(theEmin/dBin) 88 72 { … … 105 89 edgeMax = binVector[numberOfBin-1]; 106 90 107 lastBin = INT_MAX;108 lastEnergy = -DBL_MAX;109 lastValue = DBL_MAX;110 91 } 111 92 … … 123 104 return success; 124 105 } 106 107 G4PhysicsLinearVector::G4PhysicsLinearVector(const G4PhysicsLinearVector& right) 108 : G4PhysicsVector(right) 109 { 110 dBin = right.dBin; 111 baseBin = right.baseBin; 112 } 113 114 G4PhysicsLinearVector& 115 G4PhysicsLinearVector::operator=(const G4PhysicsLinearVector& right) 116 { 117 // Check assignment to self 118 // 119 if(this == &right) { return *this; } 120 121 DeleteData(); 122 CopyData(right); 123 124 dBin = right.dBin; 125 baseBin = right.baseBin; 126 return *this; 127 } -
trunk/source/global/management/src/G4PhysicsLnVector.cc
r850 r921 25 25 // 26 26 // 27 // $Id: G4PhysicsLnVector.cc,v 1.1 5 2006/06/29 19:04:15 gunterExp $28 // GEANT4 tag $Name: HEAD$27 // $Id: G4PhysicsLnVector.cc,v 1.17 2008/09/22 14:49:57 gcosmo Exp $ 28 // GEANT4 tag $Name: geant4-09-02-cand-01 $ 29 29 // 30 30 // … … 34 34 // G4PhysicsLnVector.cc 35 35 // 36 // History: 37 // 27 Apr. 1999, M.G. Pia: Created, copying from G4PhysicsLogVector 38 // 11 Nov. 2000, H.Kurashige : use STL vector for dataVector and binVector 39 // 9 Mar. 2001, H.Kurashige : add PhysicsVector type and Retrieve 36 // 27 Apr 1999 - M.G.Pia: Created from G4PhysicsLogVector 40 37 // 41 38 // -------------------------------------------------------------- … … 44 41 45 42 G4PhysicsLnVector::G4PhysicsLnVector() 46 : dBin(0.), baseBin(0.)43 : G4PhysicsVector(), dBin(0.), baseBin(0.) 47 44 { 48 45 type = T_G4PhysicsLnVector; … … 50 47 51 48 G4PhysicsLnVector::G4PhysicsLnVector(size_t theNbin) 52 : dBin(0.), baseBin(0.)49 : G4PhysicsVector(), dBin(0.), baseBin(0.) 53 50 { 54 51 type = T_G4PhysicsLnVector; … … 61 58 numberOfBin = theNbin; 62 59 63 edgeMin = 0.;64 edgeMax = 0.;65 66 lastBin = INT_MAX;67 lastEnergy = -DBL_MAX;68 lastValue = DBL_MAX;69 70 60 for (size_t i=0; i<=numberOfBin; i++) 71 61 { … … 77 67 G4PhysicsLnVector::G4PhysicsLnVector(G4double theEmin, 78 68 G4double theEmax, size_t theNbin) 79 : dBin(std::log(theEmax/theEmin)/theNbin), 69 : G4PhysicsVector(), 70 dBin(std::log(theEmax/theEmin)/theNbin), 80 71 baseBin(std::log(theEmin)/dBin) 81 72 { … … 97 88 edgeMin = binVector[0]; 98 89 edgeMax = binVector[numberOfBin-1]; 99 100 lastBin = INT_MAX;101 lastEnergy = -DBL_MAX;102 lastValue = DBL_MAX;103 90 } 104 91 … … 116 103 return success; 117 104 } 105 106 G4PhysicsLnVector::G4PhysicsLnVector(const G4PhysicsLnVector& right) 107 : G4PhysicsVector(right) 108 { 109 dBin = right.dBin; 110 baseBin = right.baseBin; 111 } 112 113 G4PhysicsLnVector& 114 G4PhysicsLnVector::operator=(const G4PhysicsLnVector& right) 115 { 116 // Check assignment to self 117 // 118 if(this == &right) { return *this; } 119 120 DeleteData(); 121 CopyData(right); 122 123 dBin = right.dBin; 124 baseBin = right.baseBin; 125 return *this; 126 } -
trunk/source/global/management/src/G4PhysicsLogVector.cc
r850 r921 25 25 // 26 26 // 27 // $Id: G4PhysicsLogVector.cc,v 1. 16 2008/09/06 19:52:16 vnivanchExp $28 // GEANT4 tag $Name: HEAD$27 // $Id: G4PhysicsLogVector.cc,v 1.21 2008/09/22 08:26:33 gcosmo Exp $ 28 // GEANT4 tag $Name: geant4-09-02-cand-01 $ 29 29 // 30 30 // … … 40 40 // 26 Sep. 1996, K.Amako : Constructor with only 'bin size' added 41 41 // 11 Nov. 2000, H.Kurashige : use STL vector for dataVector and binVector 42 // 9 Mar. 2001, H.Kurashige : add PhysicsVector type and Retrieve42 // 9 Mar. 2001, H.Kurashige : added PhysicsVector type and Retrieve 43 43 // 05 Sep. 2008, V.Ivanchenko : added protections for zero-length vector 44 44 // … … 60 60 // Add extra one bin (hidden to user) to handle correctly when 61 61 // Energy=theEmax in getValue. 62 dataVector.reserve(theNbin+1); 63 binVector.reserve(theNbin+1); 62 64 63 65 numberOfBin = theNbin; 64 66 65 if(numberOfBin > 0) { 66 dataVector.resize(theNbin+1); 67 binVector.resize(theNbin+1); 68 edgeMin = 1; 69 edgeMax = numberOfBin; 70 for (size_t i=0; i<=numberOfBin; i++) { 71 binVector[i] = i + 1; 72 dataVector[i]= 0.0; 73 } 67 for (size_t i=0; i<=numberOfBin; i++) 68 { 69 binVector.push_back(0.0); 70 dataVector.push_back(0.0); 74 71 } 75 72 } … … 84 81 // Add extra one bin (hidden to user) to handle correctly when 85 82 // Energy=theEmax in getValue. 86 dataVector.res ize(theNbin+1);87 binVector.res ize(theNbin+1);83 dataVector.reserve(theNbin+1); 84 binVector.reserve(theNbin+1); 88 85 89 86 numberOfBin = theNbin; 90 87 91 if(numberOfBin > 0) { 92 for (size_t i=0; i<=numberOfBin; i++) { 93 binVector[i] = std::pow(10., std::log10(theEmin)+i*dBin); 94 dataVector[i]= 0.0; 95 } 96 edgeMin = binVector[0]; 97 edgeMax = binVector[numberOfBin-1]; 88 for (size_t i=0; i<numberOfBin+1; i++) 89 { 90 binVector.push_back(std::pow(10., std::log10(theEmin)+i*dBin)); 91 dataVector.push_back(0.0); 98 92 } 93 edgeMin = binVector[0]; 94 edgeMax = binVector[numberOfBin-1]; 99 95 } 100 96 101 G4PhysicsLogVector::~G4PhysicsLogVector(){} 97 G4PhysicsLogVector::~G4PhysicsLogVector() 98 { 99 } 102 100 103 101 G4bool G4PhysicsLogVector::Retrieve(std::ifstream& fIn, G4bool ascii) … … 112 110 return success; 113 111 } 112 113 G4PhysicsLogVector::G4PhysicsLogVector(const G4PhysicsLogVector& right) 114 : G4PhysicsVector(right) 115 { 116 dBin = right.dBin; 117 baseBin = right.baseBin; 118 } 119 120 G4PhysicsLogVector& 121 G4PhysicsLogVector::operator=(const G4PhysicsLogVector& right) 122 { 123 // Check assignment to self 124 // 125 if(this == &right) { return *this; } 126 127 DeleteData(); 128 CopyData(right); 129 130 dBin = right.dBin; 131 baseBin = right.baseBin; 132 return *this; 133 } -
trunk/source/global/management/src/G4PhysicsOrderedFreeVector.cc
r850 r921 25 25 // 26 26 // 27 // $Id: G4PhysicsOrderedFreeVector.cc,v 1.1 0 2006/06/29 19:04:20 gunterExp $28 // GEANT4 tag $Name: HEAD$27 // $Id: G4PhysicsOrderedFreeVector.cc,v 1.12 2008/09/22 14:49:57 gcosmo Exp $ 28 // GEANT4 tag $Name: geant4-09-02-cand-01 $ 29 29 // 30 30 //////////////////////////////////////////////////////////////////////// … … 61 61 G4double *Values, 62 62 size_t VectorLength) 63 : G4PhysicsVector() 63 64 { 64 65 type = T_G4PhysicsOrderedFreeVector; 65 66 66 lastBin = INT_MAX; 67 68 lastEnergy = -DBL_MAX; 69 lastValue = DBL_MAX; 70 67 dataVector.reserve(VectorLength+1); 68 binVector.reserve(VectorLength+1); 71 69 numberOfBin = VectorLength; 72 70 … … 78 76 edgeMin = binVector.front(); 79 77 edgeMax = binVector.back(); 78 binVector.push_back ( binVector[numberOfBin-1] + 1.0 ); 79 dataVector.push_back( dataVector[numberOfBin-1] ); 80 80 } 81 81 82 82 G4PhysicsOrderedFreeVector::G4PhysicsOrderedFreeVector() 83 : G4PhysicsVector() 83 84 { 84 85 type = T_G4PhysicsOrderedFreeVector; 85 86 lastBin = INT_MAX;87 lastEnergy = -DBL_MAX;88 lastValue = DBL_MAX;89 90 edgeMin = 0.0;91 edgeMax = 0.0;92 numberOfBin = 0;93 86 } 94 87 -
trunk/source/global/management/src/G4PhysicsVector.cc
r850 r921 25 25 // 26 26 // 27 // $Id: G4PhysicsVector.cc,v 1.2 2 2008/09/05 18:04:45 vnivanchExp $28 // GEANT4 tag $Name: HEAD$27 // $Id: G4PhysicsVector.cc,v 1.27 2008/10/16 12:14:36 gcosmo Exp $ 28 // GEANT4 tag $Name: geant4-09-02-cand-01 $ 29 29 // 30 30 // … … 52 52 G4PhysicsVector::G4PhysicsVector(G4bool spline) 53 53 : type(T_G4PhysicsVector), 54 edgeMin( DBL_MAX), edgeMax(0.), numberOfBin(0),54 edgeMin(0.), edgeMax(0.), numberOfBin(0), 55 55 lastEnergy(0.), lastValue(0.), lastBin(0), 56 56 secDerivative(0), useSpline(spline) 57 { 58 binVector.push_back(edgeMin); 59 dataVector.push_back(0.0); 60 } 57 {} 61 58 62 59 // -------------------------------------------------------------- … … 64 61 G4PhysicsVector::~G4PhysicsVector() 65 62 { 66 delete [] secDerivative;63 DeleteData(); 67 64 } 68 65 … … 71 68 G4PhysicsVector::G4PhysicsVector(const G4PhysicsVector& right) 72 69 { 73 *this=right;70 CopyData(right); 74 71 } 75 72 … … 81 78 if (type != right.type) { return *this; } 82 79 83 type = right.type; 84 edgeMin = right.edgeMin; 85 edgeMax = right.edgeMax; 86 numberOfBin = right.numberOfBin; 87 lastEnergy = right.lastEnergy; 88 lastValue = right.lastValue; 89 lastBin = right.lastBin; 90 dataVector = right.dataVector; 91 binVector = right.binVector; 92 secDerivative = right.secDerivative; 93 useSpline = right.useSpline; 94 comment = right.comment; 80 DeleteData(); 81 CopyData(right); 82 95 83 return *this; 96 84 } … … 108 96 { 109 97 return (this != &right); 98 } 99 100 // -------------------------------------------------------------- 101 102 void G4PhysicsVector::DeleteData() 103 { 104 delete [] secDerivative; 105 secDerivative = 0; 106 } 107 108 // -------------------------------------------------------------- 109 110 void G4PhysicsVector::CopyData(const G4PhysicsVector& vec) 111 { 112 type = vec.type; 113 edgeMin = vec.edgeMin; 114 edgeMax = vec.edgeMax; 115 numberOfBin = vec.numberOfBin; 116 lastEnergy = vec.lastEnergy; 117 lastValue = vec.lastValue; 118 lastBin = vec.lastBin; 119 dataVector = vec.dataVector; 120 binVector = vec.binVector; 121 useSpline = vec.useSpline; 122 comment = vec.comment; 123 if (vec.secDerivative) 124 { 125 secDerivative = new G4double [numberOfBin]; 126 for (size_t i=0; i<numberOfBin; i++) 127 { 128 secDerivative[i] = vec.secDerivative[i]; 129 } 130 } 131 else 132 { 133 secDerivative = 0; 134 } 110 135 } 111 136 … … 224 249 secDerivative = new G4double [numberOfBin]; 225 250 226 s ecDerivative[0] = 0.0;251 size_t n = numberOfBin-1; 227 252 228 253 // cannot compute derivatives for less than 3 points 229 if(3 > numberOfBin) { 230 secDerivative[numberOfBin-1] = 0.0 ; 254 if(3 > numberOfBin) 255 { 256 secDerivative[0] = 0.0; 257 secDerivative[n] = 0.0; 231 258 return; 232 259 } 233 260 234 G4double* u = new G4double [numberOfBin]; 235 u[0] = 0.0 ; 236 237 // Decomposition loop for tridiagonal algorithm. secDerivative[i] 238 // and u[i] are used for temporary storage of the decomposed factors. 239 240 for(size_t i=1; i<numberOfBin-1; i++) 241 { 242 G4double sig = (binVector[i]-binVector[i-1]) 243 / (binVector[i+1]-binVector[i-1]) ; 244 G4double p = sig*secDerivative[i-1] + 2.0 ; 245 secDerivative[i] = (sig - 1.0)/p ; 246 u[i] = (dataVector[i+1]-dataVector[i])/(binVector[i+1]-binVector[i]) 247 - (dataVector[i]-dataVector[i-1])/(binVector[i]-binVector[i-1]) ; 248 u[i] =(6.0*u[i]/(binVector[i+1]-binVector[i-1]) - sig*u[i-1])/p ; 249 } 250 251 G4double qn = 0.0 ; 252 G4double un = 0.0 ; 253 254 secDerivative[numberOfBin-1] = (un - qn*u[numberOfBin-2]) 255 / (qn*secDerivative[numberOfBin-2] + 1.0) ; 256 257 // The back-substitution loop for the triagonal algorithm of solving 258 // a linear system of equations. 259 260 for(G4int k=numberOfBin-2; k>=0; k--) 261 { 262 secDerivative[k] = secDerivative[k]*secDerivative[k+1] + u[k]; 263 } 264 delete [] u; 261 for(size_t i=1; i<n; i++) 262 { 263 secDerivative[i] = 264 3.0*((dataVector[i+1]-dataVector[i])/(binVector[i+1]-binVector[i]) - 265 (dataVector[i]-dataVector[i-1])/(binVector[i]-binVector[i-1])) 266 /(binVector[i+1]-binVector[i-1]); 267 } 268 secDerivative[n] = secDerivative[n-1]; 269 secDerivative[0] = secDerivative[1]; 265 270 } 266 271
Note: See TracChangeset
for help on using the changeset viewer.