Geant4
v4-10.4-release
메인 페이지
관련된 페이지
모듈
네임스페이스
클래스
파일들
파일 목록
파일 멤버
모두
클래스
네임스페이스들
파일들
함수
변수
타입정의
열거형 타입
열거형 멤버
Friends
매크로
그룹들
페이지들
source
event
src
G4SmartTrackStack.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
// $Id: G4SmartTrackStack.cc 66892 2013-01-17 10:57:59Z gunter $
28
//
29
30
#include "
G4SmartTrackStack.hh
"
31
#include "
G4VTrajectory.hh
"
32
#include "
G4Track.hh
"
33
34
void
G4SmartTrackStack::dumpStatistics
()
35
{
36
// Print to stderr so that we can split stats output from normal
37
// output of Geant4 which is typically being printed to stdout
38
for
(
int
i = 0; i <
nTurn
; i++) {
39
G4cerr
<<
stacks
[i]->
GetNTrack
() <<
" "
;
40
G4cerr
<<
stacks
[i]->
getTotalEnergy
() <<
" "
;
41
}
42
G4cerr
<<
G4endl
;
43
}
44
45
G4SmartTrackStack::G4SmartTrackStack
()
46
:fTurn(0), nTurn(5), maxNTracks(0), nTracks(0)
47
{
48
for
(
int
i=0;i<
nTurn
;i++)
49
{
50
stacks
[i] =
new
G4TrackStack
(5000);
51
energies
[i] = 0.;
52
}
53
}
54
55
G4SmartTrackStack::~G4SmartTrackStack
()
56
{
57
for
(
int
i = 0; i <
nTurn
; i++) {
58
delete
stacks
[i];
59
}
60
}
61
62
const
G4SmartTrackStack
&
63
G4SmartTrackStack::operator=
(
const
G4SmartTrackStack
&) {
64
return
*
this
;
65
}
66
67
int
G4SmartTrackStack::operator==
(
const
G4SmartTrackStack
&
right
)
const
{
68
return
(
this
==&right);
69
}
70
71
int
G4SmartTrackStack::operator!=
(
const
G4SmartTrackStack
&
right
)
const
{
72
return
(
this
!=&right);
73
}
74
75
void
G4SmartTrackStack::TransferTo
(
G4TrackStack
* aStack)
76
{
77
for
(
int
i = 0; i <
nTurn
; i++) {
78
stacks
[i]->
TransferTo
(aStack);
79
}
80
nTracks
= 0;
81
}
82
83
G4StackedTrack
G4SmartTrackStack::PopFromStack
()
84
{
85
G4StackedTrack
aStackedTrack;
86
87
if
(
nTracks
) {
88
while
(
true
) {
89
if
(
stacks
[
fTurn
]->
GetNTrack
()) {
90
aStackedTrack =
stacks
[
fTurn
]->
PopFromStack
();
91
energies
[
fTurn
] -= aStackedTrack.
GetTrack
()->
GetDynamicParticle
()->
GetTotalEnergy
();
92
nTracks
--;
93
break
;
94
}
else
{
95
fTurn
= (
fTurn
+1) %
nTurn
;
96
}
97
}
98
}
99
100
// dumpStatistics();
101
return
aStackedTrack;
102
}
103
104
enum
{
105
electronCode
= 11,
positronCode
= -11,
gammaCode
= 22,
neutronCode
= 2112
106
};
107
108
void
G4SmartTrackStack::PushToStack
(
const
G4StackedTrack
& aStackedTrack )
109
{
110
111
G4int
iDest = 0;
112
if
(aStackedTrack.
GetTrack
()->
GetParentID
()) {
113
G4int
code
= aStackedTrack.
GetTrack
()->
GetDynamicParticle
()->
GetPDGcode
();
114
if
(code ==
electronCode
)
115
iDest = 2;
116
else
if
(code ==
gammaCode
)
117
iDest = 3;
118
else
if
(code ==
positronCode
)
119
iDest = 4;
120
else
if
(code ==
neutronCode
)
121
iDest = 1;
122
}
else
{
123
// We have a primary track, which should go first.
124
fTurn
= 0;
// reseting the turn
125
}
126
stacks
[iDest]->
PushToStack
(aStackedTrack);
127
energies
[iDest] += aStackedTrack.
GetTrack
()->
GetDynamicParticle
()->
GetTotalEnergy
();
128
nTracks
++;
129
130
G4int
dy1 =
stacks
[iDest]->
GetNTrack
() -
stacks
[iDest]->
GetSafetyValve1
();
131
G4int
dy2 =
stacks
[
fTurn
]->
GetNTrack
() -
stacks
[
fTurn
]->
GetSafetyValve2
();
132
133
if
(dy1 > 0 || dy1 > dy2 ||
134
(iDest == 2 &&
135
stacks
[iDest]->
GetNTrack
() < 50 &&
energies
[iDest] <
energies
[
fTurn
])) {
136
fTurn = iDest;
137
}
138
139
if
(
nTracks
>
maxNTracks
)
maxNTracks
=
nTracks
;
140
}
141
142
void
G4SmartTrackStack::clear
()
143
{
144
for
(
int
i = 0; i <
nTurn
; i++) {
145
stacks
[i]->clear();
146
energies
[i] = 0.0;
147
fTurn
= 0;
148
}
149
nTracks
= 0;
150
}
151
152
void
G4SmartTrackStack::clearAndDestroy
()
153
{
154
for
(
int
i = 0; i <
nTurn
; i++) {
155
stacks
[i]->
clearAndDestroy
();
156
energies
[i] = 0.0;
157
fTurn
= 0;
158
}
159
nTracks
= 0;
160
}
right
Definition:
F04UserTrackInformation.hh:37
gammaCode
Definition:
G4SmartTrackStack.cc:105
G4SmartTrackStack::nTracks
G4int nTracks
Definition:
G4SmartTrackStack.hh:78
G4SmartTrackStack::clear
void clear()
Definition:
G4SmartTrackStack.cc:142
G4TrackStack::GetSafetyValve2
G4int GetSafetyValve2() const
Definition:
G4TrackStack.hh:77
G4DynamicParticle::GetPDGcode
G4int GetPDGcode() const
G4SmartTrackStack::energies
G4double energies[5]
Definition:
G4SmartTrackStack.hh:70
G4endl
#define G4endl
Definition:
G4ios.hh:61
electronCode
Definition:
G4SmartTrackStack.cc:105
G4SmartTrackStack::TransferTo
void TransferTo(G4TrackStack *aStack)
Definition:
G4SmartTrackStack.cc:75
G4SmartTrackStack::GetNTrack
G4int GetNTrack() const
Definition:
G4SmartTrackStack.hh:81
G4TrackStack::PushToStack
void PushToStack(const G4StackedTrack &aStackedTrack)
Definition:
G4TrackStack.hh:62
G4SmartTrackStack::stacks
G4TrackStack * stacks[5]
Definition:
G4SmartTrackStack.hh:71
G4TrackStack::GetNTrack
G4int GetNTrack() const
Definition:
G4TrackStack.hh:74
G4SmartTrackStack.hh
positronCode
Definition:
G4SmartTrackStack.cc:105
G4VTrajectory.hh
G4TrackStack::PopFromStack
G4StackedTrack PopFromStack()
Definition:
G4TrackStack.hh:63
G4TrackStack::clearAndDestroy
void clearAndDestroy()
Definition:
G4TrackStack.cc:40
G4TrackStack::getTotalEnergy
G4double getTotalEnergy(void) const
Definition:
G4TrackStack.cc:61
G4cerr
G4GLOB_DLL std::ostream G4cerr
G4SmartTrackStack::G4SmartTrackStack
G4SmartTrackStack()
Definition:
G4SmartTrackStack.cc:45
G4Track.hh
G4SmartTrackStack::maxNTracks
G4int maxNTracks
Definition:
G4SmartTrackStack.hh:77
code
Definition:
inftrees.h:24
G4SmartTrackStack::clearAndDestroy
void clearAndDestroy()
Definition:
G4SmartTrackStack.cc:152
G4SmartTrackStack::operator==
G4int operator==(const G4SmartTrackStack &right) const
Definition:
G4SmartTrackStack.cc:67
G4TrackStack::GetSafetyValve1
G4int GetSafetyValve1() const
Definition:
G4TrackStack.hh:76
G4TrackStack::TransferTo
void TransferTo(G4TrackStack *aStack)
Definition:
G4TrackStack.cc:49
G4int
int G4int
Definition:
G4Types.hh:78
G4SmartTrackStack
Definition:
G4SmartTrackStack.hh:46
G4SmartTrackStack::~G4SmartTrackStack
~G4SmartTrackStack()
Definition:
G4SmartTrackStack.cc:55
G4SmartTrackStack::nTurn
G4int nTurn
Definition:
G4SmartTrackStack.hh:69
G4SmartTrackStack::operator=
const G4SmartTrackStack & operator=(const G4SmartTrackStack &right)
Definition:
G4SmartTrackStack.cc:63
G4SmartTrackStack::PopFromStack
G4StackedTrack PopFromStack()
Definition:
G4SmartTrackStack.cc:83
G4DynamicParticle::GetTotalEnergy
G4double GetTotalEnergy() const
G4StackedTrack
Definition:
G4StackedTrack.hh:45
neutronCode
Definition:
G4SmartTrackStack.cc:105
G4SmartTrackStack::dumpStatistics
void dumpStatistics()
Definition:
G4SmartTrackStack.cc:34
G4Track::GetDynamicParticle
const G4DynamicParticle * GetDynamicParticle() const
G4TrackStack
Definition:
G4TrackStack.hh:49
G4SmartTrackStack::operator!=
G4int operator!=(const G4SmartTrackStack &right) const
Definition:
G4SmartTrackStack.cc:71
G4StackedTrack::GetTrack
G4Track * GetTrack() const
Definition:
G4StackedTrack.hh:57
G4SmartTrackStack::fTurn
G4int fTurn
Definition:
G4SmartTrackStack.hh:68
G4Track::GetParentID
G4int GetParentID() const
G4SmartTrackStack::PushToStack
void PushToStack(const G4StackedTrack &aStackedTrack)
Definition:
G4SmartTrackStack.cc:108
다음에 의해 생성됨 :
1.8.5