///////////////////////////////////////////////////////////////////////// // G4Tutorial: // // PhysicsDecay.cc // // Decay for unstable particles. // ///////////////////////////////////////////////////////////////////////// #include "PhysicsDecay.hh" #include "G4ParticleDefinition.hh" #include "G4ProcessManager.hh" #include "G4Decay.hh" PhysicsDecay::PhysicsDecay(const G4String& name): G4VPhysicsConstructor(name) { G4cout<< "DECAY PROCESS: G4Decay (unstable particles)" << G4endl; } PhysicsDecay::~PhysicsDecay() { } void PhysicsDecay::ConstructProcess() { G4Decay* decayProcess = new G4Decay(); theParticleIterator -> reset(); while( (*theParticleIterator)() ) { G4ParticleDefinition* particle = theParticleIterator -> value(); if(decayProcess -> IsApplicable(*particle) && !particle -> IsShortLived()) { G4String name = particle -> GetParticleName(); G4ProcessManager* processManager = particle -> GetProcessManager(); processManager -> AddProcess(decayProcess); processManager -> SetProcessOrdering(decayProcess, idxPostStep); processManager -> SetProcessOrdering(decayProcess, idxAtRest); } } }