- Timestamp:
- Nov 25, 2009, 5:13:58 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/processes/hadronic/models/util/src/G4Fancy3DNucleus.cc
r962 r1196 68 68 if(theNucleons) delete [] theNucleons; 69 69 70 // this was delected already:71 // std::for_each(theRWNucleons.begin(), theRWNucleons.end(), DeleteNucleon());72 70 theRWNucleons.clear(); 73 71 … … 119 117 } 120 118 121 122 119 const std::vector<G4Nucleon *> & G4Fancy3DNucleus::GetNucleons() 123 120 { … … 132 129 } 133 130 131 //void G4Fancy3DNucleus::SortNucleonsIncZ() // on increased Z-coordinates Uzhi 29.08.08 132 134 133 bool G4Fancy3DNucleusHelperForSortInZ(const G4Nucleon* nuc1, const G4Nucleon* nuc2) 135 134 { … … 137 136 } 138 137 139 void G4Fancy3DNucleus::SortNucleonsInZ() 138 //void G4Fancy3DNucleus::SortNucleonsInZ() 139 void G4Fancy3DNucleus::SortNucleonsIncZ() // on increased Z-coordinates Uzhi 29.08.08 140 140 { 141 141 … … 162 162 } 163 163 164 void G4Fancy3DNucleus::SortNucleonsDecZ() // on decreased Z-coordinates Uzhi 29.08.08 165 { 166 G4Nucleon * sortedNucleons = new G4Nucleon[myA]; 167 168 GetNucleons(); // make sure theRWNucleons is initialised 169 170 if (theRWNucleons.size() < 2 ) return; 171 sort( theRWNucleons.begin(),theRWNucleons.end(),G4Fancy3DNucleusHelperForSortInZ); 172 173 // now copy sorted nucleons to theNucleons array. TheRWNucleons are pointers in theNucleons 174 // so we need to copy to new, and then swap. 175 for ( unsigned int i=0; i<theRWNucleons.size(); i++ ) 176 { 177 sortedNucleons[i]= *(theRWNucleons[myA-1-i]); // Uzhi 29.08.08 178 } 179 theRWNucleons.clear(); // about to delete array elements these point to.... 180 delete [] theNucleons; 181 theNucleons=sortedNucleons; 182 183 return; 184 } 164 185 165 186 G4double G4Fancy3DNucleus::BindingEnergy() … … 300 321 G4double arand[600]; 301 322 G4double *prand=arand; 302 // G4int Attempt=0;303 323 while ( i < myA ) 304 324 { 305 325 do 306 326 { 307 // ++Attempt;308 327 if ( jr < 3 ) 309 328 { … … 350 369 } 351 370 } 352 // G4cout << "Att " << myA << " " << Attempt << G4endl;353 371 354 372 } … … 384 402 { 385 403 G4cerr << "G4Fancy3DNucleus: difficulty finding proton momentum" << G4endl; 386 mom= 0;404 mom=G4ThreeVector(0,0,0); 387 405 } 388 406 … … 400 418 // ; 401 419 // G4cout << "final sum / mag() " << sum << " / " << sum.mag() << G4endl; 402 403 420 404 421 G4double energy; … … 531 548 // Now we have a nucleon with a bigger Fermi Momentum. 532 549 // Exchange with last nucleon.. and iterate. 533 // G4cout << " Nucleon to swap with : " << swapit << G4endl;534 // G4cout << " Fermi momentum test, and better.. " << PFermi << " / "535 // << theFermi.GetFermiMomentum(density) << G4endl;536 // cout << theNucleons[swapit]<< G4endl << theNucleons[myA-1] << G4endl;537 // cout << momentum[swapit] << G4endl << momentum[myA-1] << G4endl;538 550 G4Nucleon swap= theNucleons[swapit]; 539 551 G4ThreeVector mom_swap=momentum[swapit]; … … 545 557 momentum[myA-1]=mom_swap; 546 558 pFermiM[myA-1]=pf; 547 // cout << "after swap" <<G4endl<< theNucleons[swapit] << G4endl << theNucleons[myA-1] << G4endl;548 // cout << momentum[swapit] << G4endl << momentum[myA-1] << G4endl;549 559 return ReduceSum(momentum,pFermiM); 550 560 }
Note: See TracChangeset
for help on using the changeset viewer.