Geant4
10.00.p02
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
G4DecayTable.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
//
27
// $Id: G4DecayTable.cc 69015 2013-04-15 09:46:48Z gcosmo $
28
//
29
//
30
// ------------------------------------------------------------
31
// GEANT 4 class implementation file
32
//
33
// History: first implementation, based on object model of
34
// 27 July 1996 H.Kurashige
35
// ----------------------------------------
36
// implementation for STL 14 Feb. 2000 H.Kurashige
37
// ------------------------------------------------------------
38
39
#include "
globals.hh
"
40
#include "
G4DecayTable.hh
"
41
#include "
Randomize.hh
"
42
43
G4DecayTable::G4DecayTable
():parent(0)
44
{
45
channels
=
new
G4VDecayChannelVector
;
46
}
47
48
G4DecayTable::~G4DecayTable
()
49
{
50
// remove and delete all contents
51
G4VDecayChannelVector::iterator i;
52
for
(i =
channels
->begin(); i!=
channels
->end(); ++i) {
53
delete
(*i);
54
}
55
channels
->clear();
56
delete
channels
;
57
channels
= 0;
58
}
59
60
void
G4DecayTable::Insert
(
G4VDecayChannel
* aChannel){
61
if
(
parent
== 0) {
parent
= (
G4ParticleDefinition
*)(aChannel->
GetParent
()); }
62
if
(
parent
!= aChannel->
GetParent
()) {
63
#ifdef G4VERBOSE
64
G4cout
<<
" G4DecayTable::Insert :: bad G4VDecayChannel (mismatch parent) "
65
<<
" "
<<
parent
->
GetParticleName
()
66
<<
" input:"
<< aChannel->
GetParent
()->
GetParticleName
() <<
G4endl
;
67
#endif
68
}
else
{
69
G4double
r = aChannel->
GetBR
();
70
G4VDecayChannelVector::iterator i;
71
for
(i =
channels
->begin(); i!=
channels
->end(); ++i) {
72
if
(r > (*i)->GetBR()) {
73
channels
->insert(i,aChannel);
74
return
;
75
}
76
}
77
channels
->push_back(aChannel);
78
}
79
}
80
81
G4VDecayChannel
*
G4DecayTable::SelectADecayChannel
()
82
{
83
// check if contents exist
84
if
(
channels
->size()<1)
return
0;
85
86
while
(1) {
87
G4double
sumBR = 0.0;
88
G4double
r=
G4UniformRand
();
89
// select decay channel
90
G4VDecayChannelVector::iterator i;
91
for
(i =
channels
->begin(); i!=
channels
->end(); ++i) {
92
sumBR += (*i)->GetBR();
93
if
(r < sumBR) {
94
return
(*i);
95
}
96
}
97
}
98
return
0;
99
}
100
101
void
G4DecayTable::DumpInfo
()
const
102
{
103
G4cout
<<
"G4DecayTable: "
<<
parent
->
GetParticleName
() <<
G4endl
;
104
G4int
index =0;
105
G4VDecayChannelVector::iterator i;
106
for
(i =
channels
->begin(); i!=
channels
->end(); ++i) {
107
G4cout
<< index <<
": "
;
108
(*i)->DumpInfo();
109
index +=1;
110
}
111
G4cout
<<
G4endl
;
112
}
113
114
115
116
117
118
119
120
121
122
123
G4VDecayChannel::GetBR
G4double GetBR() const
Definition:
G4VDecayChannel.hh:332
G4ParticleDefinition
Definition:
G4ParticleDefinition.hh:111
G4int
int G4int
Definition:
G4Types.hh:78
G4ParticleDefinition::GetParticleName
const G4String & GetParticleName() const
Definition:
G4ParticleDefinition.hh:159
G4VDecayChannel
Definition:
G4VDecayChannel.hh:101
G4UniformRand
#define G4UniformRand()
Definition:
Randomize.hh:87
G4cout
G4GLOB_DLL std::ostream G4cout
G4DecayTable::DumpInfo
void DumpInfo() const
Definition:
G4DecayTable.cc:101
Randomize.hh
globals.hh
G4DecayTable::channels
G4VDecayChannelVector * channels
Definition:
G4DecayTable.hh:96
G4DecayTable::SelectADecayChannel
G4VDecayChannel * SelectADecayChannel()
Definition:
G4DecayTable.cc:81
G4DecayTable::Insert
void Insert(G4VDecayChannel *aChannel)
Definition:
G4DecayTable.cc:60
G4DecayTable::G4VDecayChannelVector
std::vector< G4VDecayChannel * > G4VDecayChannelVector
Definition:
G4DecayTable.hh:58
G4endl
#define G4endl
Definition:
G4ios.hh:61
G4double
double G4double
Definition:
G4Types.hh:76
G4DecayTable::parent
G4ParticleDefinition * parent
Definition:
G4DecayTable.hh:95
G4DecayTable.hh
G4VDecayChannel::GetParent
G4ParticleDefinition * GetParent()
Definition:
G4VDecayChannel.hh:291
G4DecayTable::~G4DecayTable
~G4DecayTable()
Definition:
G4DecayTable.cc:48
G4DecayTable::G4DecayTable
G4DecayTable()
Definition:
G4DecayTable.cc:43
geant4.10.00.p02
source
particles
management
src
G4DecayTable.cc
Generated on Thu Dec 31 2015 10:40:19 for Geant4 by
1.8.8