Ignore:
Timestamp:
Nov 25, 2009, 5:13:58 PM (15 years ago)
Author:
garnier
Message:

update CVS release candidate geant4.9.3.01

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/processes/hadronic/models/util/src/G4Fancy3DNucleus.cc

    r962 r1196  
    6868  if(theNucleons) delete [] theNucleons;
    6969
    70 // this was delected already:
    71 //  std::for_each(theRWNucleons.begin(), theRWNucleons.end(), DeleteNucleon());
    7270  theRWNucleons.clear();
    7371
     
    119117}
    120118
    121 
    122119const std::vector<G4Nucleon *> & G4Fancy3DNucleus::GetNucleons()
    123120{
     
    132129}
    133130
     131//void G4Fancy3DNucleus::SortNucleonsIncZ() // on increased Z-coordinates Uzhi 29.08.08
     132
    134133   bool G4Fancy3DNucleusHelperForSortInZ(const G4Nucleon* nuc1, const G4Nucleon* nuc2)
    135134{
     
    137136}   
    138137
    139 void G4Fancy3DNucleus::SortNucleonsInZ()
     138//void G4Fancy3DNucleus::SortNucleonsInZ()
     139void G4Fancy3DNucleus::SortNucleonsIncZ() // on increased Z-coordinates Uzhi 29.08.08
    140140{
    141141       
     
    162162}
    163163
     164void 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}
    164185
    165186G4double G4Fancy3DNucleus::BindingEnergy()
     
    300321        G4double arand[600];
    301322        G4double *prand=arand;
    302 //      G4int Attempt=0;
    303323        while ( i < myA )
    304324        {
    305325           do
    306326           {   
    307 //              ++Attempt;
    308327                if ( jr < 3 )
    309328                {
     
    350369           }
    351370        }
    352 //      G4cout << "Att " << myA << " " << Attempt << G4endl;
    353371
    354372}
     
    384402              {
    385403                  G4cerr << "G4Fancy3DNucleus: difficulty finding proton momentum" << G4endl;
    386                   mom=0;
     404                  mom=G4ThreeVector(0,0,0);
    387405              }
    388406
     
    400418//     ;
    401419//     G4cout << "final sum / mag() " << sum << " / " << sum.mag() << G4endl;
    402 
    403420
    404421    G4double energy;
     
    531548        // Now we have a nucleon with a bigger Fermi Momentum.
    532549        // 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;
    538550        G4Nucleon swap= theNucleons[swapit];
    539551        G4ThreeVector mom_swap=momentum[swapit];
     
    545557        momentum[myA-1]=mom_swap;
    546558        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;
    549559        return ReduceSum(momentum,pFermiM);
    550560}
Note: See TracChangeset for help on using the changeset viewer.