Geant4
9.6.p02
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
geant4_9_6_p02
source
processes
hadronic
models
cascade
cascade
src
G4InuclElementaryParticle.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$
27
// Geant4 tag: $Name: $
28
//
29
// 20100428 M. Kelsey -- Use G4InuclParticleNames enums instead of numbers,
30
// add Omega and antinucleons.
31
// 20100429 M. Kelsey -- Change "case gamma:" to "case photon:"
32
// 20100923 M. Kelsey -- Drop "uups" message when converting G4PartDef to code
33
// 20101029 M. Kelsey -- Add instantiation of new particles, antiparticles
34
// 20110214 M. Kelsey -- Drop unused "generation"
35
// 20110307 M. Kelsey -- Add random K0 mixing if K0S/K0L passed to type()
36
// 20110321 M. Kelsey -- Fix getStrangeness to return int
37
// 20110801 M. Kelsey -- Add fill() functions to replicate ctors, allowing
38
// reuse of objects as buffers; c.f. G4InuclNuclei.
39
// 20110922 M. Kelsey -- Add stream argument to printParticle() => print()
40
// 20120608 M. Kelsey -- Fix variable-name "shadowing" compiler warnings.
41
42
#include "
G4InuclElementaryParticle.hh
"
43
44
#include "
G4SystemOfUnits.hh
"
45
#include "
G4ParticleDefinition.hh
"
46
#include "
G4Proton.hh
"
47
#include "
G4Neutron.hh
"
48
#include "
G4PionPlus.hh
"
49
#include "
G4PionMinus.hh
"
50
#include "
G4PionZero.hh
"
51
#include "
G4Gamma.hh
"
52
#include "
G4KaonPlus.hh
"
53
#include "
G4KaonMinus.hh
"
54
#include "
G4KaonZero.hh
"
55
#include "
G4KaonZeroLong.hh
"
56
#include "
G4KaonZeroShort.hh
"
57
#include "
G4AntiKaonZero.hh
"
58
#include "
G4Lambda.hh
"
59
#include "
G4SigmaPlus.hh
"
60
#include "
G4SigmaZero.hh
"
61
#include "
G4SigmaMinus.hh
"
62
#include "
G4XiZero.hh
"
63
#include "
G4XiMinus.hh
"
64
#include "
G4OmegaMinus.hh
"
65
#include "
G4Deuteron.hh
"
66
#include "
G4Triton.hh
"
67
#include "
G4He3.hh
"
68
#include "
G4Alpha.hh
"
69
#include "
G4AntiProton.hh
"
70
#include "
G4AntiNeutron.hh
"
71
#include "
G4AntiDeuteron.hh
"
72
#include "
G4AntiTriton.hh
"
73
#include "
G4AntiHe3.hh
"
74
#include "
G4AntiAlpha.hh
"
75
#include "
G4Deuteron.hh
"
76
#include "
G4Diproton.hh
"
77
#include "
G4UnboundPN.hh
"
78
#include "
G4Dineutron.hh
"
79
#include "
Randomize.hh
"
80
81
#include "
G4InuclParticleNames.hh
"
82
using namespace
G4InuclParticleNames;
83
84
85
G4ParticleDefinition
*
86
G4InuclElementaryParticle::makeDefinition
(
G4int
ityp) {
87
switch
(ityp) {
88
case
proton
:
return
G4Proton::Definition
();
break
;
89
case
neutron
:
return
G4Neutron::Definition
();
break
;
90
case
pionPlus
:
return
G4PionPlus::Definition
();
break
;
91
case
pionMinus
:
return
G4PionMinus::Definition
();
break
;
92
case
pionZero
:
return
G4PionZero::Definition
();
break
;
93
case
photon
:
return
G4Gamma::Definition
();
break
;
94
case
kaonPlus
:
return
G4KaonPlus::Definition
();
break
;
95
case
kaonMinus
:
return
G4KaonMinus::Definition
();
break
;
96
case
kaonZero
:
return
G4KaonZero::Definition
();
break
;
97
case
kaonZeroBar
:
return
G4AntiKaonZero::Definition
();
break
;
98
case
lambda
:
return
G4Lambda::Definition
();
break
;
99
case
sigmaPlus
:
return
G4SigmaPlus::Definition
();
break
;
100
case
sigmaZero
:
return
G4SigmaZero::Definition
();
break
;
101
case
sigmaMinus
:
return
G4SigmaMinus::Definition
();
break
;
102
case
xiZero
:
return
G4XiZero::Definition
();
break
;
103
case
xiMinus
:
return
G4XiMinus::Definition
();
break
;
104
case
omegaMinus
:
return
G4OmegaMinus::Definition
();
break
;
105
// NOTE: The four light nuclei "particles" are actually G4Ions
106
case
deuteron
:
return
G4Deuteron::Definition
();
break
;
107
case
triton
:
return
G4Triton::Definition
();
break
;
108
case
He3
:
return
G4He3::Definition
();
break
;
109
case
alpha
:
return
G4Alpha::Definition
();
break
;
110
case
antiProton
:
return
G4AntiProton::Definition
();
break
;
111
case
antiNeutron
:
return
G4AntiNeutron::Definition
();
break
;
112
// NOTE: The the four light antinuclei "particles" are actually G4Ions
113
case
antiDeuteron
:
return
G4AntiDeuteron::Definition
();
break
;
114
case
antiTriton
:
return
G4AntiTriton::Definition
();
break
;
115
case
antiHe3
:
return
G4AntiHe3::Definition
();
break
;
116
case
antiAlpha
:
return
G4AntiAlpha::Definition
();
break
;
117
// NOTE: The three unbound dibaryons are local Bertini classes
118
case
diproton
:
return
G4Diproton::Definition
();
break
;
119
case
unboundPN
:
return
G4UnboundPN::Definition
();
break
;
120
case
dineutron
:
return
G4Dineutron::Definition
();
break
;
121
default
:
122
G4cerr
<<
" uups, unknown particle type "
<< ityp <<
G4endl
;
123
}
124
125
return
0;
126
}
127
128
// This is the inverse mapping to makeDefinition above
129
130
G4int
G4InuclElementaryParticle::type
(
const
G4ParticleDefinition
*pd) {
131
if
(pd == 0)
return
0;
132
if
(pd ==
G4Proton::Definition
())
return
proton
;
133
if
(pd ==
G4Neutron::Definition
())
return
neutron
;
134
if
(pd ==
G4PionPlus::Definition
())
return
pionPlus
;
135
if
(pd ==
G4PionMinus::Definition
())
return
pionMinus
;
136
if
(pd ==
G4PionZero::Definition
())
return
pionZero
;
137
if
(pd ==
G4Gamma::Definition
())
return
photon
;
138
if
(pd ==
G4KaonPlus::Definition
())
return
kaonPlus
;
139
if
(pd ==
G4KaonMinus::Definition
())
return
kaonMinus
;
140
if
(pd ==
G4KaonZero::Definition
())
return
kaonZero
;
141
if
(pd ==
G4AntiKaonZero::Definition
())
return
kaonZeroBar
;
142
if
(pd ==
G4Lambda::Definition
())
return
lambda
;
143
if
(pd ==
G4SigmaPlus::Definition
())
return
sigmaPlus
;
144
if
(pd ==
G4SigmaZero::Definition
())
return
sigmaZero
;
145
if
(pd ==
G4SigmaMinus::Definition
())
return
sigmaMinus
;
146
if
(pd ==
G4XiZero::Definition
())
return
xiZero
;
147
if
(pd ==
G4XiMinus::Definition
())
return
xiMinus
;
148
if
(pd ==
G4OmegaMinus::Definition
())
return
omegaMinus
;
149
// NOTE: The four light nuclei "particles" are actually G4Ions
150
if
(pd ==
G4Deuteron::Definition
())
return
deuteron
;
151
if
(pd ==
G4Triton::Definition
())
return
triton
;
152
if
(pd ==
G4He3::Definition
())
return
He3
;
153
if
(pd ==
G4Alpha::Definition
())
return
alpha
;
154
if
(pd ==
G4AntiProton::Definition
())
return
antiProton
;
155
if
(pd ==
G4AntiNeutron::Definition
())
return
antiNeutron
;
156
// NOTE: The the four light antinuclei "particles" are actually G4Ions
157
if
(pd ==
G4AntiDeuteron::Definition
())
return
antiDeuteron
;
158
if
(pd ==
G4AntiTriton::Definition
())
return
antiTriton
;
159
if
(pd ==
G4AntiHe3::Definition
())
return
antiHe3
;
160
if
(pd ==
G4AntiAlpha::Definition
())
return
antiAlpha
;
161
// NOTE: The three unbound dibaryons are local Bertini classes
162
if
(pd ==
G4Diproton::Definition
())
return
diproton
;
163
if
(pd ==
G4UnboundPN::Definition
())
return
unboundPN
;
164
if
(pd ==
G4Dineutron::Definition
())
return
dineutron
;
165
166
// Weak neutral kaons must be mixed back to strong (strangeness states)
167
if
(pd==
G4KaonZeroShort::Definition
() || pd==
G4KaonZeroLong::Definition
()) {
168
return
((
G4UniformRand
() > 0.5) ?
kaonZero
:
kaonZeroBar
);
169
}
170
171
return
0;
// Unknown objects return zero (e.g., nuclei)
172
}
173
174
void
G4InuclElementaryParticle::setType
(
G4int
ityp) {
175
setDefinition(makeDefinition(ityp));
176
}
177
178
179
// Overwrite data structure (avoids creating/copying temporaries)
180
181
void
G4InuclElementaryParticle::fill
(
const
G4LorentzVector
& mom,
G4int
ityp,
182
G4InuclParticle::Model
model
) {
183
setType(ityp);
184
setMomentum(mom);
185
setModel(model);
186
}
187
188
void
G4InuclElementaryParticle::fill
(
G4double
ekin,
G4int
ityp,
189
G4InuclParticle::Model
model
) {
190
setType(ityp);
191
setKineticEnergy(ekin);
192
setModel(model);
193
}
194
195
void
G4InuclElementaryParticle::fill
(
const
G4LorentzVector
& mom,
196
G4ParticleDefinition
* pd,
197
G4InuclParticle::Model
model
) {
198
setDefinition(pd);
199
setMomentum(mom);
200
setModel(model);
201
}
202
203
204
// Assignment operator for use with std::sort()
205
G4InuclElementaryParticle
&
206
G4InuclElementaryParticle::operator=
(
const
G4InuclElementaryParticle
&
right
) {
207
G4InuclParticle::operator=
(right);
208
return
*
this
;
209
}
210
211
212
G4int
G4InuclElementaryParticle::getStrangeness
(
G4int
ityp) {
213
G4ParticleDefinition
* pd = makeDefinition(ityp);
214
return
pd ? (pd->
GetQuarkContent
(3) - pd->
GetAntiQuarkContent
(3)) : 0;
215
}
216
217
G4double
G4InuclElementaryParticle::getParticleMass
(
G4int
ityp) {
218
G4ParticleDefinition
* pd = makeDefinition(ityp);
219
return
pd ? pd->
GetPDGMass
()*
MeV
/
GeV
: 0.0;
// From G4 to Bertini units
220
}
221
222
223
// Print particle parameters
224
225
void
G4InuclElementaryParticle::print
(std::ostream& os)
const
{
226
G4InuclParticle::print
(os);
227
os <<
G4endl
<<
" Particle: "
<< getDefinition()->GetParticleName()
228
<<
" type "
<< type() <<
" mass "
<< getMass()
229
<<
" ekin "
<< getKineticEnergy();
230
}
231
Generated on Sat May 25 2013 14:33:44 for Geant4 by
1.8.4