Geant4-11
Toggle main menu visibility
Main Page
Related Pages
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
w
x
y
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
m
n
p
r
s
t
w
y
Enumerations
a
b
c
d
e
f
g
l
m
p
r
s
t
v
y
z
Enumerator
a
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
x
z
Data Structures
Data Structures
Data Structure Index
Class Hierarchy
Data Fields
All
:
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
y
Enumerations
a
b
c
d
e
f
g
i
l
m
n
o
p
r
s
t
u
v
w
Enumerator
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Related Functions
:
a
b
c
d
g
h
i
o
q
r
s
t
Files
File List
Globals
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
x
z
Enumerations
b
c
d
e
f
g
i
j
l
m
n
p
r
s
t
w
x
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
y
Macros
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
x
y
z
Examples
•
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
environments
g4py
source
particles
pyG4ParticleList.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
// pyG4ParticleList.cc
28
//
29
// 2005 Q
30
// ====================================================================
31
#include <boost/python.hpp>
32
#include "
G4ParticleTable.hh
"
33
34
using namespace
boost::python;
35
36
// ====================================================================
37
// internal class
38
// ====================================================================
39
40
class
PyG4ParticleList
{
41
public
:
42
typedef
std::vector<G4ParticleDefinition*>
ParticleList
;
43
typedef
ParticleList::iterator
p_iterator
;
44
45
static
ParticleList
particleTableCache
;
46
47
p_iterator
p_begin
() {
48
G4ParticleTable
* particleTable=
G4ParticleTable::GetParticleTable
();
49
if
(
particleTableCache
.size() !=
static_cast<
size_t
>
(particleTable-> size()) ) {
50
particleTableCache
.clear();
51
G4ParticleTable::G4PTblDicIterator
*
theParticleIterator
= particleTable-> GetIterator();
52
theParticleIterator
-> reset();
53
while
( (*
theParticleIterator
)() ){
54
G4ParticleDefinition
* particle=
theParticleIterator
-> value();
55
particleTableCache
.push_back(particle);
56
}
57
}
58
return
particleTableCache
.begin();
59
}
60
61
p_iterator
p_end
() {
62
G4ParticleTable
* particleTable=
G4ParticleTable::GetParticleTable
();
63
if
(
particleTableCache
.size() !=
static_cast<
size_t
>
(particleTable-> size()) ) {
64
particleTableCache
.clear();
65
G4ParticleTable::G4PTblDicIterator
*
theParticleIterator
= particleTable-> GetIterator();
66
theParticleIterator
-> reset();
67
while
( (*
theParticleIterator
)() ){
68
G4ParticleDefinition
* particle=
theParticleIterator
-> value();
69
particleTableCache
.push_back(particle);
70
}
71
}
72
return
particleTableCache
.end();
73
}
74
};
75
76
PyG4ParticleList::ParticleList
PyG4ParticleList::particleTableCache
;
77
78
79
// ====================================================================
80
// module definition
81
// ====================================================================
82
void
export_PyG4ParticleList
()
83
{
84
class_<PyG4ParticleList>(
"PyG4ParticleList"
,
"particle list"
)
85
.def(
"__iter__"
, iterator<PyG4ParticleList::ParticleList>())
86
.add_property(
"particles"
, range(&
PyG4ParticleList::p_begin
,
87
&
PyG4ParticleList::p_end
))
88
;
89
}
90
G4ParticleTable.hh
theParticleIterator
#define theParticleIterator
Definition:
G4VUserPhysicsList.cc:67
G4ParticleDefinition
Definition:
G4ParticleDefinition.hh:61
G4ParticleTableIterator
Definition:
G4ParticleTableIterator.hh:38
G4ParticleTable
Definition:
G4ParticleTable.hh:60
G4ParticleTable::GetParticleTable
static G4ParticleTable * GetParticleTable()
Definition:
G4ParticleTable.cc:87
PyG4ParticleList
Definition:
pyG4ParticleList.cc:40
PyG4ParticleList::p_iterator
ParticleList::iterator p_iterator
Definition:
pyG4ParticleList.cc:43
PyG4ParticleList::p_begin
p_iterator p_begin()
Definition:
pyG4ParticleList.cc:47
PyG4ParticleList::particleTableCache
static ParticleList particleTableCache
Definition:
pyG4ParticleList.cc:45
PyG4ParticleList::ParticleList
std::vector< G4ParticleDefinition * > ParticleList
Definition:
pyG4ParticleList.cc:42
PyG4ParticleList::p_end
p_iterator p_end()
Definition:
pyG4ParticleList.cc:61
export_PyG4ParticleList
void export_PyG4ParticleList()
Definition:
pyG4ParticleList.cc:82
Generated by
1.9.3