Geant4_10
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 66241 2012-12-13 18:34:42Z gunter $
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 // -----------------------------------------------------------------------------
41 //
42 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
43 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
44 
45 #include "G4NuclearStopping.hh"
47 #include "G4SystemOfUnits.hh"
48 #include "G4PhysicalConstants.hh"
49 
50 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
51 
52 using namespace std;
53 
55  : G4VEmProcess(processName)
56 {
57  isInitialized = false;
59  SetBuildTableFlag(false);
60  enableAlongStepDoIt = true;
61  enablePostStepDoIt = false;
62  modelICRU49 = 0;
63 }
64 
65 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
66 
68 {}
69 
70 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
71 
73 {
74  return (p.GetPDGCharge() != 0.0 && !p.IsShortLived());
75 }
76 
77 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
78 
80 {
81  if(!isInitialized) {
82  isInitialized = true;
83 
84  if(!EmModel(1)) {
85  modelICRU49 = new G4ICRU49NuclearStoppingModel();
86  SetEmModel(modelICRU49);
87  }
88  AddEmModel(1, EmModel());
89  EmModel()->SetParticleChange(&nParticleChange);
90  }
91 }
92 
93 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
94 
95 G4double
97  const G4Track&, G4double, G4double, G4double&, G4GPILSelection* selection)
98 {
99  *selection = NotCandidateForSelection;
100  return DBL_MAX;
101 }
102 
103 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
104 
106  const G4Step& step)
107 {
108  nParticleChange.InitializeForAlongStep(track);
110 
112  G4double Z = std::fabs(part->GetPDGCharge()/eplus);
113 
114  if(T2 > 0.0 && T2*proton_mass_c2 < Z*Z*MeV*part->GetPDGMass()) {
115 
116  G4double length = step.GetStepLength();
117  if(length > 0.0) {
118 
119  // primary
121  G4double T = 0.5*(T1 + T2);
122  const G4MaterialCutsCouple* couple = track.GetMaterialCutsCouple();
123  G4VEmModel* mod = SelectModel(T, couple->GetIndex());
124 
125  // sample stopping
126  if(modelICRU49) { modelICRU49->SetFluctuationFlag(true); }
127  G4double nloss =
128  length*mod->ComputeDEDXPerVolume(couple->GetMaterial(), part, T);
129  if(nloss > T1) { nloss = T1; }
130  nParticleChange.SetProposedKineticEnergy(T1 - nloss);
131  nParticleChange.ProposeLocalEnergyDeposit(nloss);
132  nParticleChange.ProposeNonIonizingEnergyDeposit(nloss);
133  if(modelICRU49) { modelICRU49->SetFluctuationFlag(false); }
134  }
135  }
136  return &nParticleChange;
137 }
138 
139 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
140 
142 {}
143 
144 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
145 
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
Float_t Z
Definition: plot.C:39
bool G4bool
Definition: G4Types.hh:79
TString part[npart]
Definition: Style.C:32
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
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()