Changeset 1315 for trunk/source/processes/hadronic/models/util/src
- Timestamp:
- Jun 18, 2010, 11:42:07 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/processes/hadronic/models/util/src/G4Fragment.cc
r819 r1315 24 24 // ******************************************************************** 25 25 // 26 // 26 // $Id: G4Fragment.cc,v 1.16 2010/05/18 18:52:07 vnivanch Exp $ 27 // GEANT4 tag $Name: geant4-09-04-beta-cand-01 $ 28 // 29 //--------------------------------------------------------------------- 30 // 31 // Geant4 class G4Fragment 27 32 // 28 33 // Hadronic Process: Nuclear De-excitations 29 34 // by V. Lara (May 1998) 35 // 36 // Modifications: 37 // 03.05.2010 V.Ivanchenko General cleanup; moved obsolete methods from 38 // inline to source 39 // 30 40 31 41 #include "G4Fragment.hh" 32 42 #include "G4HadronicException.hh" 33 43 #include "G4HadTmpUtil.hh" 34 44 #include "G4Gamma.hh" 45 #include "G4Electron.hh" 46 47 G4int G4Fragment::errCount = 0; 35 48 36 49 // Default constructor … … 39 52 theZ(0), 40 53 theExcitationEnergy(0.0), 54 theGroundStateMass(0.0), 41 55 theMomentum(0), 42 56 theAngularMomentum(0), … … 57 71 theZ = right.theZ; 58 72 theExcitationEnergy = right.theExcitationEnergy; 73 theGroundStateMass = right.theGroundStateMass; 59 74 theMomentum = right.theMomentum; 60 75 theAngularMomentum = right.theAngularMomentum; … … 69 84 } 70 85 71 72 86 G4Fragment::~G4Fragment() 73 { 74 } 75 76 77 G4Fragment::G4Fragment(const G4int A, const G4int Z, const G4LorentzVector aMomentum) : 87 {} 88 89 G4Fragment::G4Fragment(const G4int A, const G4int Z, const G4LorentzVector& aMomentum) : 78 90 theA(A), 79 91 theZ(Z), … … 89 101 #endif 90 102 { 103 theExcitationEnergy = 0.0; 104 theGroundStateMass = 0.0; 105 if(theA > 0) { 106 CalculateGroundStateMass(); 107 CalculateExcitationEnergy(); 108 } 109 /* 91 110 theExcitationEnergy = theMomentum.mag() - 92 111 G4ParticleTable::GetParticleTable()->GetIonTable() … … 102 121 } 103 122 } 104 } 105 106 107 // This constructor is for initialize photons 108 G4Fragment::G4Fragment(const G4LorentzVector aMomentum, G4ParticleDefinition * aParticleDefinition) : 123 */ 124 } 125 126 127 // This constructor is for initialize photons or electrons 128 G4Fragment::G4Fragment(const G4LorentzVector& aMomentum, 129 G4ParticleDefinition * aParticleDefinition) : 109 130 theA(0), 110 131 theZ(0), … … 120 141 #endif 121 142 { 122 theExcitationEnergy = CalculateExcitationEnergy(aMomentum); 123 } 124 125 143 theExcitationEnergy = 0.0; 144 if(aParticleDefinition != G4Gamma::Gamma() && 145 aParticleDefinition != G4Electron::Electron()) { 146 G4String text = "G4Fragment::G4Fragment constructor for gamma used for " 147 + aParticleDefinition->GetParticleName(); 148 throw G4HadronicException(__FILE__, __LINE__, text); 149 } 150 theGroundStateMass = aParticleDefinition->GetPDGMass(); 151 } 126 152 127 153 const G4Fragment & G4Fragment::operator=(const G4Fragment &right) … … 131 157 theZ = right.theZ; 132 158 theExcitationEnergy = right.theExcitationEnergy; 159 theGroundStateMass = right.theGroundStateMass; 133 160 theMomentum = right.theMomentum; 134 161 theAngularMomentum = right.theAngularMomentum; … … 145 172 } 146 173 147 148 174 G4bool G4Fragment::operator==(const G4Fragment &right) const 149 175 { … … 155 181 return (this != (G4Fragment *) &right); 156 182 } 157 158 183 159 184 std::ostream& operator << (std::ostream &out, const G4Fragment *theFragment) … … 197 222 } 198 223 199 200 201 G4double G4Fragment::CalculateExcitationEnergy(const G4LorentzVector value) const 202 { 203 static G4int errCount(0); 204 G4double theMaxGroundStateMass = theZ*G4Proton::Proton()->GetPDGMass()+ 205 (theA-theZ)*G4Neutron::Neutron()->GetPDGMass(); 206 G4double U = value.m() - std::min(theMaxGroundStateMass, GetGroundStateMass()); 207 if( U < 0.0 ) { 208 if( U > -10.0 * eV || 0==G4lrint(theA)){ 209 U = 0.0; 210 } else { 211 if ( errCount < 10 ) { 212 G4cerr << "G4Fragment::CalculateExcitationEnergy(): Excitation Energy =" 213 <<U << " for A = "<<theA<<" and Z= "<<theZ<<G4endl 214 << ", mass= " << GetGroundStateMass() << " maxMass= "<<theMaxGroundStateMass<<G4endl; ; 215 errCount++; 216 if (errCount == 10 ) G4cerr << "G4Fragment::CalculateExcitationEnergy():" 217 << " further warnings on negative excitation will be supressed" << G4endl; 218 } 219 U=0.0; 220 } 221 } 222 return U; 224 void G4Fragment::ExcitationEnegryWarning() 225 { 226 if (theExcitationEnergy < -10.0 * eV) { 227 ++errCount; 228 if ( errCount <= 10 ) { 229 G4cout << "G4Fragment::CalculateExcitationEnergy(): Excitation Energy = " 230 << theExcitationEnergy/MeV << " MeV for A = " 231 <<theA << " and Z= " << theZ << G4endl; 232 if( errCount == 10 ) { 233 G4String text = "G4Fragment::G4Fragment Excitation Energy < 0.0!"; 234 throw G4HadronicException(__FILE__, __LINE__, text); 235 } 236 } 237 } 238 theExcitationEnergy = 0.0; 223 239 } 224 240 … … 226 242 // Create a unit vector with a random direction isotropically distributed 227 243 { 228 229 244 G4double CosTheta = 1.0 - 2.0*G4UniformRand(); 230 245 G4double SinTheta = std::sqrt(1.0 - CosTheta*CosTheta); … … 234 249 Magnitude*CosTheta); 235 250 236 return Vector; 237 238 } 251 return Vector; 252 } 253 254 void G4Fragment::SetExcitationEnergy(const G4double ) 255 { 256 // theExcitationEnergy = value; 257 G4cout << "Warning: G4Fragment::SetExcitationEnergy() is a dummy method. Please, avoid to use it." << G4endl; 258 } 259 260 #ifdef PRECOMPOUND_TEST 261 G4String G4Fragment::GetCreatorModel() const 262 { 263 return theCreatorModel; 264 } 265 266 void G4Fragment::SetCreatorModel(const G4String & aModel) 267 { 268 theCreatorModel = aModel; 269 } 270 #endif
Note: See TracChangeset
for help on using the changeset viewer.