Import Geant4 10.2.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-10 14:11:04 +02:00
parent c9b32a6c0a
commit d4af681f38
4886 changed files with 420149 additions and 1023309 deletions
+21 -7
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4Decay.cc 79343 2014-02-24 11:44:06Z gcosmo $
// $Id: G4Decay.cc 92056 2015-08-14 13:33:43Z gcosmo $
//
//
// --------------------------------------------------------------
@@ -233,19 +233,33 @@ G4VParticleChange* G4Decay::DecayIt(const G4Track& aTrack, const G4Step& )
// decay according to external decayer
products = pExtDecayer->ImportDecayProducts(aTrack);
} else {
// decay acoording to decay table
// choose a decay channel
G4VDecayChannel *decaychannel = decaytable->SelectADecayChannel();
if (decaychannel == 0 ){
// Decay according to decay table.
// Keep trying to choose a candidate decay channel if the dynamic mass
// of the decaying particle is below the sum of the PDG masses of the
// candidate daughter particles.
// This is needed because the decay table used in Geant4 is based on
// the assumption of nominal PDG masses, but a wide resonance can have
// a dynamic masses well below its nominal PDG masses, and therefore
// some of its decay channels can be below the kinematical threshold.
// Note that, for simplicity, we ignore here the possibility that
// one or more of the candidate daughter particles can be, in turn,
// wide resonance. However, if this is the case, and the channel is
// accepted, then the masses of the resonance daughter particles will
// be sampled by taking into account their widths.
G4VDecayChannel* decaychannel = 0;
G4double massParent = aParticle->GetMass();
decaychannel = decaytable->SelectADecayChannel(massParent);
if ( decaychannel ==0) {
// decay channel not found
G4Exception("G4Decay::DoIt", "DECAY003", FatalException,
" can not determine decay channel ");
" can not determine decay channel ");
} else {
// execute DecayIt()
#ifdef G4VERBOSE
G4int temp = decaychannel->GetVerboseLevel();
if (GetVerboseLevel()>1) {
G4cout << "G4Decay::DoIt : selected decay channel addr:" << decaychannel <<G4endl;
G4cout << "G4Decay::DoIt : selected decay channel addr:"
<< decaychannel <<G4endl;
decaychannel->SetVerboseLevel(GetVerboseLevel());
}
#endif
+61 -7
View File
@@ -58,7 +58,63 @@ G4DecayWithSpin::G4DecayWithSpin(const G4String& processName):G4Decay(processNam
G4DecayWithSpin::~G4DecayWithSpin(){}
G4VParticleChange* G4DecayWithSpin::DecayIt(const G4Track& aTrack, const G4Step& aStep)
G4VParticleChange* G4DecayWithSpin::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
{
if ( (aTrack.GetTrackStatus() == fStopButAlive ) ||
(aTrack.GetTrackStatus() == fStopAndKill ) ){
fParticleChangeForDecay.Initialize(aTrack);
return &fParticleChangeForDecay;
}
// get particle
const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle();
const G4ParticleDefinition* aParticleDef = aParticle->GetDefinition();
// get parent_polarization
G4ThreeVector parent_polarization = aParticle->GetPolarization();
if(parent_polarization == G4ThreeVector(0,0,0))
{
// Generate random polarization direction
G4double cost = 1. - 2.*G4UniformRand();
G4double sint = std::sqrt((1.-cost)*(1.+cost));
G4double phi = twopi*G4UniformRand();
G4double sinp = std::sin(phi);
G4double cosp = std::cos(phi);
G4double px = sint*cosp;
G4double py = sint*sinp;
G4double pz = cost;
parent_polarization.setX(px);
parent_polarization.setY(py);
parent_polarization.setZ(pz);
}
// decay table
G4DecayTable *decaytable = aParticleDef->GetDecayTable();
if (decaytable) {
for (G4int ip=0; ip<decaytable->entries(); ip++){
decaytable->GetDecayChannel(ip)->SetPolarization(parent_polarization);
}
}
G4ParticleChangeForDecay* pParticleChangeForDecay;
pParticleChangeForDecay = (G4ParticleChangeForDecay*)G4Decay::DecayIt(aTrack,aStep);
pParticleChangeForDecay->ProposePolarization(parent_polarization);
//G4cout << parent_polarization.x() << ", "
// << parent_polarization.y() << ", "
// << parent_polarization.z() << G4endl;
return pParticleChangeForDecay;
}
G4VParticleChange* G4DecayWithSpin::AtRestDoIt(const G4Track& aTrack, const G4Step& aStep)
{
// get particle
@@ -126,15 +182,13 @@ G4VParticleChange* G4DecayWithSpin::DecayIt(const G4Track& aTrack, const G4Step&
// decay table
G4DecayTable *decaytable = aParticleDef->GetDecayTable();
if (decaytable) {
G4MuonDecayChannelWithSpin *decaychannel;
decaychannel = (G4MuonDecayChannelWithSpin*)decaytable->SelectADecayChannel();
if (decaychannel) decaychannel->SetPolarization(parent_polarization);
}
for (G4int ip=0; ip<decaytable->entries(); ip++){
decaytable->GetDecayChannel(ip)->SetPolarization(parent_polarization);
}
}
G4ParticleChangeForDecay* pParticleChangeForDecay;
pParticleChangeForDecay = (G4ParticleChangeForDecay*)G4Decay::DecayIt(aTrack,aStep);
pParticleChangeForDecay->ProposePolarization(parent_polarization);