Import Geant4 9.3.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 16:15:05 +02:00
parent b79225fb37
commit 74cad5e589
3877 changed files with 234205 additions and 167127 deletions
@@ -67,8 +67,6 @@ void G4Fancy3DNucleus::Init(G4double theA, G4double theZ)
currentNucleon=-1;
if(theNucleons) delete [] theNucleons;
// this was delected already:
// std::for_each(theRWNucleons.begin(), theRWNucleons.end(), DeleteNucleon());
theRWNucleons.clear();
myZ = G4int(theZ);
@@ -118,7 +116,6 @@ G4Nucleon * G4Fancy3DNucleus::GetNextNucleon()
theNucleons+currentNucleon++ : 0;
}
const std::vector<G4Nucleon *> & G4Fancy3DNucleus::GetNucleons()
{
if ( theRWNucleons.size()==0 )
@@ -131,12 +128,15 @@ const std::vector<G4Nucleon *> & G4Fancy3DNucleus::GetNucleons()
return theRWNucleons;
}
//void G4Fancy3DNucleus::SortNucleonsIncZ() // on increased Z-coordinates Uzhi 29.08.08
bool G4Fancy3DNucleusHelperForSortInZ(const G4Nucleon* nuc1, const G4Nucleon* nuc2)
{
return nuc1->GetPosition().z() < nuc2->GetPosition().z();
}
void G4Fancy3DNucleus::SortNucleonsInZ()
//void G4Fancy3DNucleus::SortNucleonsInZ()
void G4Fancy3DNucleus::SortNucleonsIncZ() // on increased Z-coordinates Uzhi 29.08.08
{
GetNucleons(); // make sure theRWNucleons is initialised
@@ -161,6 +161,27 @@ void G4Fancy3DNucleus::SortNucleonsInZ()
return;
}
void G4Fancy3DNucleus::SortNucleonsDecZ() // on decreased Z-coordinates Uzhi 29.08.08
{
G4Nucleon * sortedNucleons = new G4Nucleon[myA];
GetNucleons(); // make sure theRWNucleons is initialised
if (theRWNucleons.size() < 2 ) return;
sort( theRWNucleons.begin(),theRWNucleons.end(),G4Fancy3DNucleusHelperForSortInZ);
// now copy sorted nucleons to theNucleons array. TheRWNucleons are pointers in theNucleons
// so we need to copy to new, and then swap.
for ( unsigned int i=0; i<theRWNucleons.size(); i++ )
{
sortedNucleons[i]= *(theRWNucleons[myA-1-i]); // Uzhi 29.08.08
}
theRWNucleons.clear(); // about to delete array elements these point to....
delete [] theNucleons;
theNucleons=sortedNucleons;
return;
}
G4double G4Fancy3DNucleus::BindingEnergy()
{
@@ -299,12 +320,10 @@ void G4Fancy3DNucleus::ChoosePositions()
G4int jx,jy;
G4double arand[600];
G4double *prand=arand;
// G4int Attempt=0;
while ( i < myA )
{
do
{
// ++Attempt;
if ( jr < 3 )
{
jr=std::min(600,9*(myA - i));
@@ -349,7 +368,6 @@ void G4Fancy3DNucleus::ChoosePositions()
}
}
}
// G4cout << "Att " << myA << " " << Attempt << G4endl;
}
@@ -383,7 +401,7 @@ void G4Fancy3DNucleus::ChooseFermiMomenta()
} else
{
G4cerr << "G4Fancy3DNucleus: difficulty finding proton momentum" << G4endl;
mom=0;
mom=G4ThreeVector(0,0,0);
}
}
@@ -400,7 +418,6 @@ void G4Fancy3DNucleus::ChooseFermiMomenta()
// ;
// G4cout << "final sum / mag() " << sum << " / " << sum.mag() << G4endl;
G4double energy;
for ( i=0; i< myA ; i++ )
{
@@ -530,11 +547,6 @@ G4bool G4Fancy3DNucleus::ReduceSum(G4ThreeVector * momentum, G4double *pFermiM)
// Now we have a nucleon with a bigger Fermi Momentum.
// Exchange with last nucleon.. and iterate.
// G4cout << " Nucleon to swap with : " << swapit << G4endl;
// G4cout << " Fermi momentum test, and better.. " << PFermi << " / "
// << theFermi.GetFermiMomentum(density) << G4endl;
// cout << theNucleons[swapit]<< G4endl << theNucleons[myA-1] << G4endl;
// cout << momentum[swapit] << G4endl << momentum[myA-1] << G4endl;
G4Nucleon swap= theNucleons[swapit];
G4ThreeVector mom_swap=momentum[swapit];
G4double pf=pFermiM[swapit];
@@ -544,8 +556,6 @@ G4bool G4Fancy3DNucleus::ReduceSum(G4ThreeVector * momentum, G4double *pFermiM)
theNucleons[myA-1]=swap;
momentum[myA-1]=mom_swap;
pFermiM[myA-1]=pf;
// cout << "after swap" <<G4endl<< theNucleons[swapit] << G4endl << theNucleons[myA-1] << G4endl;
// cout << momentum[swapit] << G4endl << momentum[myA-1] << G4endl;
return ReduceSum(momentum,pFermiM);
}