Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4NuclearStopping.cc
Go to the documentation of this file.
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 79188 2014-02-20 09:22:48Z gcosmo $
27 //
28 // -----------------------------------------------------------------------------
29 //
30 // GEANT4 Class file
31 //
32 // File name: G4NuclearStopping
33 //
34 // Author: Vladimir Ivanchenko
35 //
36 // Creation date: 20 July 2009
37 //
38 // Modified:
39 //
40 // Warning: this class should be instantiated after G4ionIonisation
41 //
42 // -----------------------------------------------------------------------------
43 //
44 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
45 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
46 
47 #include "G4NuclearStopping.hh"
49 #include "G4SystemOfUnits.hh"
50 #include "G4PhysicalConstants.hh"
51 
52 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
53 
54 using namespace std;
55 
57  : G4VEmProcess(processName)
58 {
59  isInitialized = false;
61  SetBuildTableFlag(false);
62  enableAlongStepDoIt = true;
63  enablePostStepDoIt = false;
64  modelICRU49 = 0;
65 }
66 
67 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
68 
70 {}
71 
72 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
73 
75 {
76  return (p.GetPDGCharge() != 0.0 && !p.IsShortLived());
77 }
78 
79 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
80 
82 {
83  if(!isInitialized) {
84  isInitialized = true;
85 
86  if(!EmModel(1)) {
87  modelICRU49 = new G4ICRU49NuclearStoppingModel();
88  SetEmModel(modelICRU49);
89  }
90  AddEmModel(1, EmModel());
91  EmModel()->SetParticleChange(&nParticleChange);
92  }
93 }
94 
95 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
96 
97 G4double
99  const G4Track&, G4double, G4double, G4double&, G4GPILSelection* selection)
100 {
101  *selection = NotCandidateForSelection;
102  return DBL_MAX;
103 }
104 
105 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
106 
108  const G4Step& step)
109 {
110  nParticleChange.InitializeForAlongStep(track);
111 
112  // this line only valid if nuclear stopping
113  // is computed after G4ionIonisation process
114  nParticleChange.SetProposedCharge(step.GetPostStepPoint()->GetCharge());
115 
117 
118  const G4ParticleDefinition* part = track.GetParticleDefinition();
119  G4double Z = std::fabs(part->GetPDGCharge()/eplus);
120 
121  if(T2 > 0.0 && T2*proton_mass_c2 < Z*Z*MeV*part->GetPDGMass()) {
122 
123  G4double length = step.GetStepLength();
124  if(length > 0.0) {
125 
126  // primary
128  G4double T = 0.5*(T1 + T2);
129  const G4MaterialCutsCouple* couple = track.GetMaterialCutsCouple();
130  G4VEmModel* mod = SelectModel(T, couple->GetIndex());
131 
132  // sample stopping
133  if(modelICRU49) { modelICRU49->SetFluctuationFlag(true); }
134  G4double nloss =
135  length*mod->ComputeDEDXPerVolume(couple->GetMaterial(), part, T);
136  if(nloss > T1) { nloss = T1; }
137  nParticleChange.SetProposedKineticEnergy(T1 - nloss);
138  nParticleChange.ProposeLocalEnergyDeposit(nloss);
139  nParticleChange.ProposeNonIonizingEnergyDeposit(nloss);
140  if(modelICRU49) { modelICRU49->SetFluctuationFlag(false); }
141  }
142  }
143  return &nParticleChange;
144 }
145 
146 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
147 
149 {}
150 
151 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
152 
G4NuclearStopping(const G4String &processName="nuclearStopping")
G4VEmModel * SelectModel(G4double &kinEnergy, size_t index)
G4double GetStepLength() const
void InitialiseProcess(const G4ParticleDefinition *)
void SetBuildTableFlag(G4bool val)
G4VEmModel * EmModel(G4int index=1) const
const char * p
Definition: xmltok.h:285
G4bool IsApplicable(const G4ParticleDefinition &p)
const G4MaterialCutsCouple * GetMaterialCutsCouple() const
void InitializeForAlongStep(const G4Track &)
void ProposeLocalEnergyDeposit(G4double anEnergyPart)
G4StepPoint * GetPreStepPoint() const
void SetEmModel(G4VEmModel *, G4int index=1)
void ProposeNonIonizingEnergyDeposit(G4double anEnergyPart)
void SetParticleChange(G4VParticleChange *, G4VEmFluctuationModel *f=0)
Definition: G4VEmModel.cc:387
bool G4bool
Definition: G4Types.hh:79
G4double GetCharge() const
void SetProposedKineticEnergy(G4double proposedKinEnergy)
const G4ParticleDefinition * GetParticleDefinition() const
void SetProcessSubType(G4int)
Definition: G4VProcess.hh:432
Definition: G4Step.hh:76
G4bool enablePostStepDoIt
Definition: G4VProcess.hh:352
G4VParticleChange * AlongStepDoIt(const G4Track &track, const G4Step &step)
G4double AlongStepGetPhysicalInteractionLength(const G4Track &track, G4double previousStepSize, G4double currentMinimumStep, G4double &proposedSafety, G4GPILSelection *selection)
virtual G4double ComputeDEDXPerVolume(const G4Material *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=DBL_MAX)
Definition: G4VEmModel.cc:236
void AddEmModel(G4int, G4VEmModel *, const G4Region *region=0)
G4StepPoint * GetPostStepPoint() const
void SetProposedCharge(G4double theCharge)
G4bool enableAlongStepDoIt
Definition: G4VProcess.hh:351
G4double GetKineticEnergy() const
double G4double
Definition: G4Types.hh:76
G4double GetPDGCharge() const
#define DBL_MAX
Definition: templates.hh:83
G4GPILSelection
const G4Material * GetMaterial() const
virtual ~G4NuclearStopping()