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
source
graphics_reps
include
G4SmartFilter.hh
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
// Filter with additional funcionality such as active and inverted states,
28
// and filtering statistics
29
//
30
// Jane Tinslay, March 2006
31
//
32
#ifndef G4SMARTFILTER_HH
33
#define G4SMARTFILTER_HH
34
35
#include "
G4VFilter.hh
"
36
37
template
<
typename
T>
38
class
G4SmartFilter
:
public
G4VFilter
<T> {
39
40
public
:
// With description
41
42
// Construct with filter name
43
G4SmartFilter
(
const
G4String
&
name
);
44
45
virtual
~G4SmartFilter
();
46
47
// Evaluate method implemented in subclass
48
virtual
G4bool
Evaluate
(
const
T&)
const
= 0;
49
50
// Print subclass configuration
51
virtual
void
Print
(std::ostream& ostr)
const
= 0;
52
53
// Clear filter
54
virtual
void
Clear
() = 0;
55
56
// Filter method
57
G4bool
Accept
(
const
T&)
const
;
58
59
// Print G4SmartFilter configuration
60
virtual
void
PrintAll
(std::ostream& ostr)
const
;
61
62
//Reset
63
virtual
void
Reset
();
64
65
// Activate/deactivate filter
66
void
SetActive
(
const
G4bool
&);
67
G4bool
GetActive
()
const
;
68
69
// Invert filter
70
void
SetInvert
(
const
G4bool
&);
71
G4bool
GetInvert
()
const
;
72
73
// Set verbosity
74
void
SetVerbose
(
const
G4bool
&);
75
G4bool
GetVerbose
()
const
;
76
77
78
private
:
79
80
// Data members
81
G4bool
fActive
;
82
G4bool
fInvert
;
83
G4bool
fVerbose
;
84
mutable
size_t
fNPassed
;
85
mutable
size_t
fNProcessed
;
86
87
};
88
89
template
<
typename
T>
90
G4SmartFilter<T>::G4SmartFilter
(
const
G4String
&
name
)
91
:
G4VFilter
<T>(
name
)
92
,fActive(true)
93
,fInvert(false)
94
,fVerbose(false)
95
,fNPassed(0)
96
,fNProcessed(0)
97
{}
98
99
template
<
typename
T>
100
G4SmartFilter<T>::~G4SmartFilter
() {}
101
102
template
<
typename
T>
103
G4bool
104
G4SmartFilter<T>::Accept
(
const
T&
object
)
const
105
{
106
if
(fVerbose) {
107
G4cout
<<
"Begin verbose printout for filter "
<<
G4VFilter<T>::Name
()<<
G4endl
;
108
G4cout
<<
"Active ? : "
<<fActive<<
G4endl
;
109
}
110
111
fNProcessed++;
112
113
// Pass everything if filter is not active
114
if
(!fActive) {
115
fNPassed++;
116
return
true
;
117
}
118
119
// Do filtering
120
G4bool
passed = Evaluate(
object
);
121
122
// Apply inversion if applicable
123
if
(fInvert) passed = !passed;
124
125
if
(passed) fNPassed++;
126
127
if
(fVerbose) {
128
G4cout
<<
"Inverted ? : "
<<fInvert<<
G4endl
;
129
G4cout
<<
"Passed ? : "
<<passed<<
G4endl
;
130
G4cout
<<
"End verbose printout for filter "
<<
G4VFilter<T>::Name
()<<
G4endl
;
131
}
132
133
return
passed;
134
}
135
136
template
<
typename
T>
137
void
138
G4SmartFilter<T>::PrintAll
(std::ostream& ostr)
const
139
{
140
ostr<<
"Printing data for filter: "
<<
G4VFilter<T>::Name
()<<
G4endl
;
141
142
Print
(ostr);
143
144
ostr<<
"Active ? : "
<<fActive<<
G4endl
;
145
ostr<<
"Inverted ? : "
<<fInvert<<
G4endl
;
146
ostr<<
"#Processed : "
<<fNProcessed<<
G4endl
;
147
ostr<<
"#Passed : "
<<fNPassed<<
G4endl
;
148
}
149
150
template
<
typename
T>
151
void
152
G4SmartFilter<T>::Reset
()
153
{
154
fActive =
true
;
155
fInvert =
false
;
156
fNProcessed = 0;
157
fNPassed = 0;
158
159
// Clear subclass data
160
Clear();
161
}
162
163
template
<
typename
T>
164
void
165
G4SmartFilter<T>::SetActive
(
const
G4bool
& active)
166
{
167
fActive = active;
168
}
169
170
template
<
typename
T>
171
G4bool
172
G4SmartFilter<T>::GetActive
()
const
173
{
174
return
fActive;
175
}
176
177
template
<
typename
T>
178
void
179
G4SmartFilter<T>::SetInvert
(
const
G4bool
& invert)
180
{
181
fInvert = invert;
182
}
183
184
template
<
typename
T>
185
G4bool
186
G4SmartFilter<T>::GetInvert
()
const
187
{
188
return
fInvert;
189
}
190
191
template
<
typename
T>
192
void
193
G4SmartFilter<T>::SetVerbose
(
const
G4bool
& verbose)
194
{
195
fVerbose = verbose;
196
}
197
198
template
<
typename
T>
199
G4bool
200
G4SmartFilter<T>::GetVerbose
()
const
201
{
202
return
fVerbose;
203
}
204
205
#endif
206
G4bool
bool G4bool
Definition:
G4Types.hh:86
G4VFilter.hh
G4endl
#define G4endl
Definition:
G4ios.hh:57
G4cout
G4GLOB_DLL std::ostream G4cout
G4SmartFilter
Definition:
G4SmartFilter.hh:38
G4SmartFilter::Print
virtual void Print(std::ostream &ostr) const =0
G4SmartFilter::PrintAll
virtual void PrintAll(std::ostream &ostr) const
Definition:
G4SmartFilter.hh:138
G4SmartFilter::SetVerbose
void SetVerbose(const G4bool &)
Definition:
G4SmartFilter.hh:193
G4SmartFilter::Reset
virtual void Reset()
Definition:
G4SmartFilter.hh:152
G4SmartFilter::fNPassed
size_t fNPassed
Definition:
G4SmartFilter.hh:84
G4SmartFilter::G4SmartFilter
G4SmartFilter(const G4String &name)
Definition:
G4SmartFilter.hh:90
G4SmartFilter::Evaluate
virtual G4bool Evaluate(const T &) const =0
G4SmartFilter::Clear
virtual void Clear()=0
G4SmartFilter::fVerbose
G4bool fVerbose
Definition:
G4SmartFilter.hh:83
G4SmartFilter::GetVerbose
G4bool GetVerbose() const
Definition:
G4SmartFilter.hh:200
G4SmartFilter::fActive
G4bool fActive
Definition:
G4SmartFilter.hh:81
G4SmartFilter::SetActive
void SetActive(const G4bool &)
Definition:
G4SmartFilter.hh:165
G4SmartFilter::fNProcessed
size_t fNProcessed
Definition:
G4SmartFilter.hh:85
G4SmartFilter::GetActive
G4bool GetActive() const
Definition:
G4SmartFilter.hh:172
G4SmartFilter::~G4SmartFilter
virtual ~G4SmartFilter()
Definition:
G4SmartFilter.hh:100
G4SmartFilter::SetInvert
void SetInvert(const G4bool &)
Definition:
G4SmartFilter.hh:179
G4SmartFilter::fInvert
G4bool fInvert
Definition:
G4SmartFilter.hh:82
G4SmartFilter::Accept
G4bool Accept(const T &) const
Definition:
G4SmartFilter.hh:104
G4SmartFilter::GetInvert
G4bool GetInvert() const
Definition:
G4SmartFilter.hh:186
G4String
Definition:
G4String.hh:62
G4VFilter
Definition:
G4VFilter.hh:39
G4VFilter::Name
G4String Name() const
Definition:
G4VFilter.hh:80
G4InuclParticleNames::name
const char * name(G4int ptype)
Definition:
G4InuclParticleNames.hh:76
pyG4Element::Print
void Print(G4Element &ele)
Definition:
pyG4Element.cc:55
Generated by
1.9.3