ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
G4eplusAnnihilation.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file G4eplusAnnihilation.cc
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
// -------------------------------------------------------------------
28
//
29
// GEANT4 Class file
30
//
31
//
32
// File name: G4eplusAnnihilation
33
//
34
// Author: Vladimir Ivanchenko on base of Michel Maire code
35
//
36
// Creation date: 02.08.2004
37
//
38
// Modified by Michel Maire, Vladimir Ivanchenko and Daren Sawkey
39
40
//
41
// -------------------------------------------------------------------
42
//
43
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
44
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
45
46
#include "
G4eplusAnnihilation.hh
"
47
#include "
G4PhysicalConstants.hh
"
48
#include "
G4MaterialCutsCouple.hh
"
49
#include "
G4Gamma.hh
"
50
#include "
G4Positron.hh
"
51
#include "
G4eeToTwoGammaModel.hh
"
52
#include "
G4EmBiasingManager.hh
"
53
54
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
55
56
using namespace
std;
57
58
G4eplusAnnihilation::G4eplusAnnihilation
(
const
G4String
&
name
)
59
:
G4VEmProcess
(name), isInitialised(
false
)
60
{
61
theGamma
=
G4Gamma::Gamma
();
62
SetIntegral
(
true
);
63
SetBuildTableFlag
(
false
);
64
SetStartFromNullFlag
(
false
);
65
SetSecondaryParticle
(
theGamma
);
66
SetProcessSubType
(
fAnnihilation
);
67
enableAtRestDoIt
=
true
;
68
mainSecondaries
= 2;
69
}
70
71
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
72
73
G4eplusAnnihilation::~G4eplusAnnihilation
()
74
{}
75
76
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
77
78
G4bool
G4eplusAnnihilation::IsApplicable
(
const
G4ParticleDefinition
&
p
)
79
{
80
return
(&p ==
G4Positron::Positron
());
81
}
82
83
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
84
85
G4double
G4eplusAnnihilation::AtRestGetPhysicalInteractionLength
(
86
const
G4Track
&,
G4ForceCondition
*
condition
)
87
{
88
*condition =
NotForced
;
89
return
0.0;
90
}
91
92
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
93
94
void
G4eplusAnnihilation::InitialiseProcess
(
const
G4ParticleDefinition
*)
95
{
96
if
(!
isInitialised
) {
97
isInitialised
=
true
;
98
if
(!
EmModel
(0)) {
SetEmModel
(
new
G4eeToTwoGammaModel
()); }
99
EmModel
(0)->
SetLowEnergyLimit
(
MinKinEnergy
());
100
EmModel
(0)->
SetHighEnergyLimit
(
MaxKinEnergy
());
101
AddEmModel
(1,
EmModel
(0));
102
}
103
}
104
105
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
106
107
void
G4eplusAnnihilation::StreamProcessInfo
(std::ostream&)
const
108
{}
109
110
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
111
112
G4VParticleChange
*
G4eplusAnnihilation::AtRestDoIt
(
const
G4Track
&
track
,
113
const
G4Step
&
step
)
114
// Performs the e+ e- annihilation when both particles are assumed at rest.
115
{
116
fParticleChange
.
InitializeForPostStep
(track);
117
size_t
idx
=
CurrentMaterialCutsCoupleIndex
();
118
G4double
ene(0.0);
119
G4VEmModel
*
model
=
SelectModel
(ene, idx);
120
121
// define new weight for primary and secondaries
122
G4double
weight
=
fParticleChange
.
GetParentWeight
();
123
124
// sample secondaries
125
secParticles
.clear();
126
G4double
gammaCut =
GetGammaEnergyCut
();
127
model->
SampleSecondaries
(&
secParticles
,
MaterialCutsCouple
(),
128
track.
GetDynamicParticle
(), gammaCut);
129
130
G4int
num0 =
secParticles
.size();
131
132
// splitting or Russian roulette
133
if
(
biasManager
) {
134
if
(
biasManager
->
SecondaryBiasingRegion
(idx)) {
135
G4double
eloss = 0.0;
136
weight *=
biasManager
->
ApplySecondaryBiasing
(
137
secParticles
, track, model, &
fParticleChange
, eloss,
138
idx, gammaCut, step.
GetPostStepPoint
()->
GetSafety
());
139
if
(eloss > 0.0) {
140
eloss +=
fParticleChange
.
GetLocalEnergyDeposit
();
141
fParticleChange
.
ProposeLocalEnergyDeposit
(eloss);
142
}
143
}
144
}
145
// save secondaries
146
G4int
num
=
secParticles
.size();
147
if
(num > 0) {
148
149
fParticleChange
.
SetNumberOfSecondaries
(num);
150
G4double
edep
=
fParticleChange
.
GetLocalEnergyDeposit
();
151
G4double
time
= track.
GetGlobalTime
();
152
153
for
(
G4int
i=0; i<
num
; ++i) {
154
if
(
secParticles
[i]) {
155
G4DynamicParticle
* dp =
secParticles
[i];
156
const
G4ParticleDefinition
*
p
= dp->
GetParticleDefinition
();
157
G4double
e
= dp->
GetKineticEnergy
();
158
G4bool
good =
true
;
159
if
(
ApplyCuts
()) {
160
if
(p ==
theGamma
) {
161
if
(e < gammaCut) { good =
false
; }
162
}
else
if
(p ==
theElectron
) {
163
if
(e <
GetElectronEnergyCut
()) { good =
false
; }
164
}
165
// added secondary if it is good
166
}
167
if
(good) {
168
G4Track
*
t
=
new
G4Track
(dp, time, track.
GetPosition
());
169
t->
SetTouchableHandle
(track.
GetTouchableHandle
());
170
if
(
biasManager
) {
171
t->
SetWeight
(weight *
biasManager
->
GetWeight
(i));
172
}
else
{
173
t->
SetWeight
(weight);
174
}
175
pParticleChange
->
AddSecondary
(t);
176
177
// define type of secondary
178
if
(i <
mainSecondaries
) { t->
SetCreatorModelIndex
(
secID
); }
179
else
if
(i < num0) {
180
if
(p ==
theGamma
) {
181
t->
SetCreatorModelIndex
(
fluoID
);
182
}
else
{
183
t->
SetCreatorModelIndex
(
augerID
);
184
}
185
}
else
{
186
t->
SetCreatorModelIndex
(
biasID
);
187
}
188
/*
189
G4cout << "Secondary(post step) has weight " << t->GetWeight()
190
<< ", Ekin= " << t->GetKineticEnergy()/MeV << " MeV "
191
<< GetProcessName() << " fluoID= " << fluoID
192
<< " augerID= " << augerID <<G4endl;
193
*/
194
}
else
{
195
delete
dp;
196
edep +=
e
;
197
}
198
}
199
}
200
fParticleChange
.
ProposeLocalEnergyDeposit
(edep);
201
}
202
return
&
fParticleChange
;
203
}
204
205
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
206
207
void
G4eplusAnnihilation::ProcessDescription
(std::ostream& out)
const
208
{
209
out <<
" Positron annihilation"
;
210
G4VEmProcess::ProcessDescription
(out);
211
}
212
213
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
geant4
tree
geant4-10.6-release
source
processes
electromagnetic
standard
src
G4eplusAnnihilation.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:34
using
1.8.2 with
ECCE GitHub integration