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 | // $Id: G4NuclearStopping.cc,v 1.2 2009/11/10 19:25:47 vnivanch Exp $ |
---|
27 | // GEANT4 tag $Name: geant4-09-03 $ |
---|
28 | // |
---|
29 | // ----------------------------------------------------------------------------- |
---|
30 | // |
---|
31 | // GEANT4 Class file |
---|
32 | // |
---|
33 | // File name: G4NuclearStopping |
---|
34 | // |
---|
35 | // Author: Vladimir Ivanchenko |
---|
36 | // |
---|
37 | // Creation date: 20 July 2009 |
---|
38 | // |
---|
39 | // Modified: |
---|
40 | // |
---|
41 | // ----------------------------------------------------------------------------- |
---|
42 | // |
---|
43 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
44 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
45 | |
---|
46 | #include "G4NuclearStopping.hh" |
---|
47 | #include "G4ICRU49NuclearStoppingModel.hh" |
---|
48 | |
---|
49 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
50 | |
---|
51 | using namespace std; |
---|
52 | |
---|
53 | G4NuclearStopping::G4NuclearStopping(const G4String& processName) |
---|
54 | : G4VEmProcess(processName) |
---|
55 | { |
---|
56 | isInitialized = false; |
---|
57 | SetProcessSubType(fCoulombScattering); |
---|
58 | enableAlongStepDoIt = true; |
---|
59 | modelICRU49 = 0; |
---|
60 | } |
---|
61 | |
---|
62 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
63 | |
---|
64 | G4NuclearStopping::~G4NuclearStopping() |
---|
65 | { |
---|
66 | delete modelICRU49; |
---|
67 | } |
---|
68 | |
---|
69 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
70 | |
---|
71 | G4bool G4NuclearStopping::IsApplicable (const G4ParticleDefinition& p) |
---|
72 | { |
---|
73 | return (p.GetPDGCharge() != 0.0 && !p.IsShortLived()); |
---|
74 | } |
---|
75 | |
---|
76 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
77 | |
---|
78 | void G4NuclearStopping::InitialiseProcess(const G4ParticleDefinition*) |
---|
79 | { |
---|
80 | if(!isInitialized) { |
---|
81 | isInitialized = true; |
---|
82 | SetBuildTableFlag(false); |
---|
83 | // SetSecondaryParticle(G4Electron::Electron()); |
---|
84 | if(!Model()) { |
---|
85 | modelICRU49 = new G4ICRU49NuclearStoppingModel(); |
---|
86 | SetModel(modelICRU49); |
---|
87 | } |
---|
88 | AddEmModel(1, Model()); |
---|
89 | Model()->SetParticleChange(&nParticleChange); |
---|
90 | } |
---|
91 | } |
---|
92 | |
---|
93 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
94 | |
---|
95 | G4double |
---|
96 | G4NuclearStopping::AlongStepGetPhysicalInteractionLength( |
---|
97 | const G4Track&, G4double, G4double, G4double&, G4GPILSelection* selection) |
---|
98 | { |
---|
99 | *selection = NotCandidateForSelection; |
---|
100 | return DBL_MAX; |
---|
101 | } |
---|
102 | |
---|
103 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
104 | |
---|
105 | G4VParticleChange* G4NuclearStopping::AlongStepDoIt(const G4Track& track, |
---|
106 | const G4Step& step) |
---|
107 | { |
---|
108 | nParticleChange.InitializeForAlongStep(track); |
---|
109 | G4double length = step.GetStepLength(); |
---|
110 | if(length > 0.0) { |
---|
111 | |
---|
112 | G4double T1 = step.GetPreStepPoint()->GetKineticEnergy(); |
---|
113 | G4double T2 = step.GetPostStepPoint()->GetKineticEnergy(); |
---|
114 | if(T2 > 0.0) { |
---|
115 | |
---|
116 | // primary |
---|
117 | G4double T = 0.5*(T1 + T2); |
---|
118 | const G4ParticleDefinition* part = track.GetDefinition(); |
---|
119 | const G4MaterialCutsCouple* couple = track.GetMaterialCutsCouple(); |
---|
120 | G4VEmModel* mod = SelectModel(T, couple->GetIndex()); |
---|
121 | |
---|
122 | // sample stopping |
---|
123 | if(modelICRU49) modelICRU49->SetFluctuationFlag(true); |
---|
124 | G4double nloss = |
---|
125 | length*mod->ComputeDEDXPerVolume(couple->GetMaterial(), part, T); |
---|
126 | if(nloss > T1) nloss = T1; |
---|
127 | nParticleChange.SetProposedKineticEnergy(T1 - nloss); |
---|
128 | nParticleChange.ProposeLocalEnergyDeposit(nloss); |
---|
129 | nParticleChange.ProposeNonIonizingEnergyDeposit(nloss); |
---|
130 | if(modelICRU49) modelICRU49->SetFluctuationFlag(false); |
---|
131 | } |
---|
132 | } |
---|
133 | return &nParticleChange; |
---|
134 | } |
---|
135 | |
---|
136 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
137 | |
---|
138 | void G4NuclearStopping::PrintInfo() |
---|
139 | {} |
---|
140 | |
---|
141 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
142 | |
---|