Changeset 1340 for trunk/source/processes/hadronic/models/de_excitation/photon_evaporation/src/G4NuclearLevel.cc
- Timestamp:
- Nov 5, 2010, 3:45:55 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/processes/hadronic/models/de_excitation/photon_evaporation/src/G4NuclearLevel.cc
r819 r1340 24 24 // ******************************************************************** 25 25 // 26 // 26 // $Id: G4NuclearLevel.cc,v 1.5 2010/10/10 23:01:39 mkelsey Exp $ 27 27 // ------------------------------------------------------------------- 28 28 // GEANT 4 class file … … 39 39 // 40 40 // Modifications: 41 // 06 Oct 2010, M. Kelsey (kelsey@slac.stanford.edu) 42 // Add friendship for G4NuclearLevelManager; define private 43 // constructors without vectors. 41 44 // 42 45 // 09 Sep. 2002, Fan Lei (flei@space.qinetiq.com) … … 63 66 instanceCount+=aF; 64 67 return instanceCount; 68 } 69 70 G4NuclearLevel::G4NuclearLevel() 71 : _energy(0.), _halfLife(0.), _angularMomentum(0.), _nGammas(0) { 72 // G4cout << "####### Incrementing "<<Increment(1)<<G4endl; 73 } 74 75 G4NuclearLevel::G4NuclearLevel(const G4double energy, const G4double halfLife, 76 const G4double angularMomentum) 77 : _energy(energy), _halfLife(halfLife), _angularMomentum(angularMomentum), 78 _nGammas(0) { 79 // G4cout << "####### Incrementing "<<Increment(1)<<G4endl; 65 80 } 66 81 … … 77 92 const std::vector<double>& totalCC) 78 93 79 { 80 _energy = energy; 81 _halfLife = halfLife; 82 _angularMomentum = angularMomentum; 83 unsigned int i; 84 for (i=0; i<eGamma.size(); i++) 85 { 86 _energies.push_back(eGamma[i]); 87 _weights.push_back(wGamma[i]); 88 _polarities.push_back(polarities[i]); 89 _kCC.push_back( kCC[i]); 90 _l1CC.push_back( l1CC[i]); 91 _l2CC.push_back( l2CC[i]); 92 _l3CC.push_back( l3CC[i]); 93 _m1CC.push_back( m1CC[i]); 94 _m2CC.push_back( m2CC[i]); 95 _m3CC.push_back( m3CC[i]); 96 _m4CC.push_back( m4CC[i]); 97 _m5CC.push_back( m5CC[i]); 98 _nPlusCC.push_back( nPlusCC[i]); 99 _totalCC.push_back( totalCC[i]); 100 } 101 _nGammas = _energies.size(); 102 MakeProbabilities(); 103 MakeCumProb(); 104 // G4cout << "####### Incrementing "<<Increment(1)<<G4endl; 94 : _energies(eGamma), _weights(wGamma), _polarities(polarities), 95 _kCC(kCC), _l1CC(l1CC), _l2CC(l2CC), _l3CC(l3CC), 96 _m1CC(m1CC), _m2CC(m2CC), _m3CC(m3CC), _m4CC(m4CC), _m5CC(m5CC), 97 _nPlusCC(nPlusCC), _totalCC(totalCC), 98 _energy(energy), _halfLife(halfLife), _angularMomentum(angularMomentum) 99 { 100 Finalize(); 101 // G4cout << "####### Incrementing "<<Increment(1)<<G4endl; 105 102 } 106 103 … … 255 252 return; 256 253 } 257 254 255 256 void G4NuclearLevel::Finalize() { 257 _nGammas = _energies.size(); 258 MakeProbabilities(); 259 MakeCumProb(); 260 } 261 258 262 259 263 void G4NuclearLevel::MakeProbabilities() … … 261 265 G4double sum = 0.; 262 266 G4int i = 0; 263 for (i=0; i<_nGammas; i++) 264 { 265 sum += _weights[i]*(1+_totalCC[i]); 267 for (i=0; i<_nGammas; i++) { 268 sum += _weights[i]*(1.+_totalCC[i]); 269 } 270 271 if (sum <= 0.) _prob.resize(_nGammas, 1./_nGammas); // Fast fill 272 else { 273 _prob.reserve(_nGammas); 274 for (i=0; i<_nGammas; i++) { 275 _prob.push_back(_weights[i]*(1.+_totalCC[i])/sum); 266 276 } 267 268 for (i=0; i<_nGammas; i++) 269 { 270 if (sum > 0.) { _prob.push_back(_weights[i]*(1+_totalCC[i])/ sum); } 271 else { _prob.push_back(1./_nGammas); } 272 } 273 return; 277 } 274 278 } 275 279 … … 277 281 void G4NuclearLevel::MakeCumProb() 278 282 { 279 if (_nGammas > 0) 280 { 281 G4double sum = _prob[0]; 282 _cumProb.push_back(sum); 283 284 G4int i = 0; 285 for (i=1; i<_nGammas; i++) 286 { 287 sum += _prob[i]; 288 _cumProb.push_back(sum); 289 } 290 } 291 return; 292 } 293 294 295 283 if (_nGammas <= 0) return; 284 285 _cumProb.reserve(_nGammas); 286 287 G4double sum = _prob[0]; 288 _cumProb.push_back(sum); 289 290 for (G4int i=1; i<_nGammas; i++) { 291 sum += _prob[i]; 292 _cumProb.push_back(sum); 293 } 294 } 295 296 297
Note: See TracChangeset
for help on using the changeset viewer.