| 1 | //
|
|---|
| 2 | // ********************************************************************
|
|---|
| 3 | // * License and Disclaimer *
|
|---|
| 4 | // * *
|
|---|
| 5 | // * The Geant4 software is copyright of the Copyright Holders of *
|
|---|
| 6 | // * the Geant4 Collaboration. It is provided under the terms and *
|
|---|
| 7 | // * conditions of the Geant4 Software License, included in the file *
|
|---|
| 8 | // * LICENSE and available at http://cern.ch/geant4/license . These *
|
|---|
| 9 | // * include a list of copyright holders. *
|
|---|
| 10 | // * *
|
|---|
| 11 | // * Neither the authors of this software system, nor their employing *
|
|---|
| 12 | // * institutes,nor the agencies providing financial support for this *
|
|---|
| 13 | // * work make any representation or warranty, express or implied, *
|
|---|
| 14 | // * regarding this software system or assume any liability for its *
|
|---|
| 15 | // * use. Please see the license in the file LICENSE and URL above *
|
|---|
| 16 | // * for the full disclaimer and the limitation of liability. *
|
|---|
| 17 | // * *
|
|---|
| 18 | // * This code implementation is the result of the scientific and *
|
|---|
| 19 | // * technical work of the GEANT4 collaboration. *
|
|---|
| 20 | // * By using, copying, modifying or distributing the software (or *
|
|---|
| 21 | // * any work based on the software) you agree to acknowledge its *
|
|---|
| 22 | // * use in resulting scientific publications, and indicate your *
|
|---|
| 23 | // * acceptance of all terms of the Geant4 Software license. *
|
|---|
| 24 | // ********************************************************************
|
|---|
| 25 | //
|
|---|
| 26 | //
|
|---|
| 27 | // $Id: G4DNAProcess.icc,v 1.12 2009/01/20 07:50:28 sincerti Exp $
|
|---|
| 28 | // GEANT4 tag $Name: geant4-09-03-cand-01 $
|
|---|
| 29 | //
|
|---|
| 30 | // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
|
|---|
| 31 | //
|
|---|
| 32 | // Reference: TNS Geant4-DNA paper
|
|---|
| 33 | //
|
|---|
| 34 |
|
|---|
| 35 | // History:
|
|---|
| 36 | // -----------
|
|---|
| 37 | // Date Name Modification
|
|---|
| 38 | // 28 Apr 2007 M.G. Pia Created in compliance with design described in TNS paper
|
|---|
| 39 | //
|
|---|
| 40 | // -------------------------------------------------------------------
|
|---|
| 41 |
|
|---|
| 42 |
|
|---|
| 43 | template <class TCrossSection,class TFinalState>
|
|---|
| 44 | G4double G4DNAProcess<TCrossSection,TFinalState>::GetMeanFreePath(const G4Track& track,
|
|---|
| 45 | G4double /* previousStepSize */,
|
|---|
| 46 | G4ForceCondition* /* condition */)
|
|---|
| 47 | {
|
|---|
| 48 | G4double meanFreePath = DBL_MAX;
|
|---|
| 49 |
|
|---|
| 50 | // Assume the interacting medium to be water; one of the elements must be oxygen
|
|---|
| 51 | G4Material* material(track.GetMaterial());
|
|---|
| 52 | size_t i = material->GetNumberOfElements();
|
|---|
| 53 | while (i>0)
|
|---|
| 54 | {
|
|---|
| 55 | i--;
|
|---|
| 56 | const G4Element* element(material->GetElement(i));
|
|---|
| 57 | if (element->GetZ() == 8.)
|
|---|
| 58 | {
|
|---|
| 59 | // Number of oxygen atoms per volume = number of water molecules per volume
|
|---|
| 60 | G4double density = material->GetAtomicNumDensityVector()[i];
|
|---|
| 61 | // G4cout << "density = " << density << G4endl;
|
|---|
| 62 | if (density > 0.)
|
|---|
| 63 | {
|
|---|
| 64 | G4double cross = crossSection.CrossSection(track);
|
|---|
| 65 | if (cross > 0.0) meanFreePath = 1. / (density*cross);
|
|---|
| 66 | if (meanFreePath == 0.) meanFreePath = DBL_MIN;
|
|---|
| 67 | return meanFreePath;
|
|---|
| 68 | }
|
|---|
| 69 | }
|
|---|
| 70 | } // end while
|
|---|
| 71 |
|
|---|
| 72 | // If it ends up here, it means that the material is not water
|
|---|
| 73 | G4Exception("G4DNAProcess::GetMeanFreePath - material is not water");
|
|---|
| 74 | // One does not really need a return statement here
|
|---|
| 75 | return DBL_MAX;
|
|---|
| 76 | }
|
|---|
| 77 |
|
|---|
| 78 |
|
|---|
| 79 | template <class TCrossSection,class TFinalState>
|
|---|
| 80 | G4VParticleChange* G4DNAProcess<TCrossSection,TFinalState>::PostStepDoIt(const G4Track& track, const G4Step& step)
|
|---|
| 81 | {
|
|---|
| 82 | aParticleChange.Initialize(track);
|
|---|
| 83 |
|
|---|
| 84 | // G4cout << "Track initialized" << G4endl;
|
|---|
| 85 |
|
|---|
| 86 | // Interaction product
|
|---|
| 87 | const G4FinalStateProduct& product = finalState.GenerateFinalState(track,step);
|
|---|
| 88 |
|
|---|
| 89 | // Number of secondary products to be generated
|
|---|
| 90 | G4int nSecondaries = product.NumberOfSecondaries();
|
|---|
| 91 | aParticleChange.SetNumberOfSecondaries(nSecondaries);
|
|---|
| 92 |
|
|---|
| 93 | // Secondaries
|
|---|
| 94 | for (G4int l = 0; l<nSecondaries; l++ )
|
|---|
| 95 | {
|
|---|
| 96 | G4DynamicParticle* particle = product.GetSecondaries()[l];
|
|---|
| 97 | if (particle != 0)
|
|---|
| 98 | {
|
|---|
| 99 | // aParticleChange.SetNumberOfSecondaries(nSecondaries);
|
|---|
| 100 | aParticleChange.AddSecondary(particle);
|
|---|
| 101 | }
|
|---|
| 102 | }
|
|---|
| 103 |
|
|---|
| 104 | // Take care of incident particle to be killed, if necessary; dump its energy deposit locally
|
|---|
| 105 | G4double deposit = product.GetEnergyDeposit();
|
|---|
| 106 | if (deposit > 0.0) aParticleChange.ProposeLocalEnergyDeposit(deposit);
|
|---|
| 107 |
|
|---|
| 108 | if (product.PrimaryParticleIsKilled())
|
|---|
| 109 | {
|
|---|
| 110 | aParticleChange.ProposeTrackStatus(fStopAndKill);
|
|---|
| 111 | aParticleChange.ProposeEnergy(0.);
|
|---|
| 112 | aParticleChange.ProposeMomentumDirection( 0., 0., 0. );
|
|---|
| 113 |
|
|---|
| 114 | if (product.PrimaryParticleIsKilledAndDoNotDepositEnergy())
|
|---|
| 115 | {
|
|---|
| 116 | aParticleChange.ProposeLocalEnergyDeposit(deposit);
|
|---|
| 117 | }
|
|---|
| 118 | else
|
|---|
| 119 | {
|
|---|
| 120 | aParticleChange.ProposeLocalEnergyDeposit(track.GetKineticEnergy() + deposit);
|
|---|
| 121 | }
|
|---|
| 122 |
|
|---|
| 123 | }
|
|---|
| 124 | else
|
|---|
| 125 | {
|
|---|
| 126 | // Modify incident particle kinematics taking into account the generated products
|
|---|
| 127 |
|
|---|
| 128 | // ---- MGP ---- Temporary: assume at most one secondary product
|
|---|
| 129 | // Sebastien: please check if consistent with current models or generalize
|
|---|
| 130 |
|
|---|
| 131 | // Primary particle momentum and kinetic energy
|
|---|
| 132 | G4ThreeVector primaryMomentum = track.GetMomentum();
|
|---|
| 133 | G4double primaryKineticEnergy = track.GetKineticEnergy();
|
|---|
| 134 |
|
|---|
| 135 | // Secondary product momentum and energy
|
|---|
| 136 |
|
|---|
| 137 | G4double secondaryKineticEnergy = 0.;
|
|---|
| 138 | if (nSecondaries >0 )
|
|---|
| 139 | {
|
|---|
| 140 | G4DynamicParticle* secondary = product.GetSecondaries()[0];
|
|---|
| 141 | secondaryKineticEnergy = secondary->GetKineticEnergy();
|
|---|
| 142 |
|
|---|
| 143 | // Calculate new primary particle kinetic energy
|
|---|
| 144 | G4double finalKineticEnergy = primaryKineticEnergy - secondaryKineticEnergy - deposit;
|
|---|
| 145 |
|
|---|
| 146 | if (finalKineticEnergy <= 0.0)
|
|---|
| 147 | {
|
|---|
| 148 | // Primary particle is stopped; kill it
|
|---|
| 149 | aParticleChange.ProposeTrackStatus(fStopAndKill);
|
|---|
| 150 | aParticleChange.ProposeEnergy(0.);
|
|---|
| 151 | aParticleChange.ProposeMomentumDirection( 0., 0., 0. );
|
|---|
| 152 | }
|
|---|
| 153 | else
|
|---|
| 154 | {
|
|---|
| 155 | // Calculate new primary particle momentum: difference between original primary one and secondary
|
|---|
| 156 | G4ThreeVector secondaryMomentum = secondary->GetMomentum();
|
|---|
| 157 | G4ThreeVector finalMomentum = primaryMomentum - secondaryMomentum;
|
|---|
| 158 | G4ThreeVector finalDirection = finalMomentum.unit();
|
|---|
| 159 | aParticleChange.ProposeMomentumDirection(finalDirection);
|
|---|
| 160 | aParticleChange.ProposeEnergy(finalKineticEnergy);
|
|---|
| 161 | }
|
|---|
| 162 | }
|
|---|
| 163 | else
|
|---|
| 164 | {
|
|---|
| 165 | // Check whether primary particle is modified
|
|---|
| 166 | if (product.PrimaryParticleIsModified())
|
|---|
| 167 | {
|
|---|
| 168 | G4ThreeVector finalDirection = product.GetModifiedDirection();
|
|---|
| 169 | aParticleChange.ProposeMomentumDirection(finalDirection);
|
|---|
| 170 | G4double finalKineticEnergy = product.GetModifiedEnergy();
|
|---|
| 171 | aParticleChange.ProposeEnergy(finalKineticEnergy);
|
|---|
| 172 | }
|
|---|
| 173 | }
|
|---|
| 174 |
|
|---|
| 175 | }
|
|---|
| 176 |
|
|---|
| 177 | return G4VDiscreteProcess::PostStepDoIt(track,step );
|
|---|
| 178 | }
|
|---|