Files
geant4/source/processes/electromagnetic/lowenergy/include/G4DNAChargeDecreaseInWater.icc
T
2016-06-09 14:44:26 +02:00

86 lines
4.5 KiB
Plaintext

//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4DNAChargeDecreaseInWater.icc,v 1.4 2006/06/29 19:33:42 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
#ifdef G4DNACHARGEDECREASEINWATER_HH
template<typename TotalCrossSectionPolicy, typename FinalStatesPolicy>
G4VParticleChange * G4DNAChargeDecreaseInWater<TotalCrossSectionPolicy, FinalStatesPolicy> :: PostStepDoIt(const G4Track & aTrack, const G4Step & aStep)
{
this->aParticleChange.Initialize(aTrack);
this->aParticleChange.ProposeTrackStatus(fStopAndKill);
G4double inK(aTrack.GetDynamicParticle()->GetKineticEnergy());
const G4int z(10); // H2O number of electrons
G4int finalStateIndex(TotalCrossSectionPolicy::RandomizePartialCrossSection(inK, z));
G4int n(FinalStatesPolicy::NumberOfFinalStates(finalStateIndex));
G4double waterBindingEnergy(FinalStatesPolicy::WaterBindingEnergyConstant(finalStateIndex));
G4double outgoingParticleBindingEnergy(FinalStatesPolicy::OutgoingParticleBindingEnergyConstant(finalStateIndex));
G4double outK(inK - n*(inK*electron_mass_c2/proton_mass_c2) - waterBindingEnergy + outgoingParticleBindingEnergy);
if (outK<0)
{
G4String message;
message="G4DNAChargeDecreaseInWater<>::PostStepDoIt - Final kinetic energy is below 0! Process ";
message+=this->GetProcessName();
G4Exception(message);
}
this->aParticleChange.ProposeLocalEnergyDeposit(waterBindingEnergy);
this->aParticleChange.SetNumberOfSecondaries(1);
this->aParticleChange.AddSecondary(new G4DynamicParticle(FinalStatesPolicy::OutgoingParticleDefinition(finalStateIndex), aTrack.GetDynamicParticle()->GetMomentumDirection(), outK));
return G4VDNAProcessInWater<TotalCrossSectionPolicy, FinalStatesPolicy>::PostStepDoIt(aTrack, aStep);
/* aParticleChange.Initialize(aTrack);
G4double k=aTrack.GetDynamicParticle()->GetKineticEnergy();
G4int finalStateIndex(FinalStatesPolicy::NumberOfFinalStates());
G4int randomShell;
G4double electronBindingEnergy=0.;
for(G4int index=0; index<finalStateIndex; index++)
{
randomShell = TotalCrossSectionPolicy::RandomizePartialCrossSection(k);
electronBindingEnergy+=TotalCrossSectionPolicy::WaterBindingEnergy(randomShell);
}
G4double overallBindingEnergy(FinalStatesPolicy::OverallBindingEnergyConstant(finalStateIndex));
aParticleChange.ProposeLocalEnergyDeposit(electronBindingEnergy);
aParticleChange.SetNumberOfSecondaries(1);
G4DynamicParticle *newParticle = new G4DynamicParticle(FinalStatesPolicy::OutgoingParticleDefinition(finalStateIndex),
aTrack.GetDynamicParticle()->GetMomentumDirection(),
k-finalStateIndex*(k*electron_mass_c2/proton_mass_c2)-electronBindingEnergy+overallBindingEnergy);
aParticleChange.ProposeTrackStatus(fStopAndKill);
aParticleChange.AddSecondary(newParticle);
return G4VDNAProcessInWater<TotalCrossSectionPolicy, FinalStatesPolicy>::PostStepDoIt(aTrack, aStep); */
}
#endif /* G4DNACHARGEDECREASEINWATER_HH */