Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
wire-cell-build
iface
test
test_wireplaneid.cxx
Go to the documentation of this file.
1
2
#include "
WireCellIface/WirePlaneId.h
"
3
#include "
WireCellUtil/Testing.h
"
4
5
#include <iostream>
6
7
using namespace
WireCell
;
8
using namespace
std
;
9
10
int
main
()
11
{
12
WirePlaneLayer_t
layers
[] = {
kUnknownLayer
,
kUlayer
,
kVlayer
,
kWlayer
};
13
14
15
WirePlaneId
u(
kUlayer
), v(
kVlayer
),
w
(kWlayer);
16
17
cerr <<
"u.ident="
<< u.ident() <<
" v.ident="
<< v.ident() <<
" w.ident="
<< w.
ident
() <<
endl
;
18
cerr <<
"u="
<< u <<
" v="
<< v <<
" w="
<< w <<
endl
;
19
20
Assert
(u.ident() == 1);
21
Assert
(v.ident() == 2);
22
Assert
(w.
ident
() == 4);
23
24
Assert
(u.ilayer() == 1);
25
Assert
(v.ilayer() == 2);
26
Assert
(w.
ilayer
() == 4);
27
28
Assert
(u.layer() ==
kUlayer
);
29
Assert
(v.layer() ==
kVlayer
);
30
Assert
(w.
layer
() ==
kWlayer
);
31
32
Assert
(u.index() == 0);
33
Assert
(v.index() == 1);
34
Assert
(w.
index
() == 2);
35
36
for
(
int
ilayer = 0; ilayer< 4; ++ilayer) {
37
WirePlaneLayer_t
layer = layers[ilayer];
38
for
(
int
face=0; face < 2 ; ++face) {
39
for
(
int
apa
= 0;
apa
< 3; ++
apa
) {
40
41
cerr <<
"Raw: "
<< ilayer <<
" "
<< layer <<
" "
<< face <<
" "
<<
apa
<<
endl
;
42
43
WirePlaneId
wpid(layer, face,
apa
);
44
45
cerr <<
"\twpid="
<< wpid <<
endl
;
46
47
cerr <<
"\tident="
<< wpid.
ident
()
48
<<
" ilayer="
<< wpid.
ilayer
()
49
<<
" layer="
<< wpid.
layer
()
50
<<
" index="
<< wpid.
index
() <<
endl
;
51
52
53
if
(ilayer) {
AssertMsg
(wpid.
valid
(),
"known layer should give true wpid"
); }
54
else
{
AssertMsg
(!wpid.
valid
(),
"unknown layer should give false wpid"
);}
55
56
Assert
(ilayer-1 == wpid.
index
());
57
Assert
(face == wpid.
face
());
58
Assert
(
apa
== wpid.
apa
());
59
}
60
}
61
62
}
63
64
}
WireCell::WirePlaneId::layer
WirePlaneLayer_t layer() const
Layer as enum.
Definition:
WirePlaneId.cxx:25
WireCell::WirePlaneId::ident
int ident() const
Unit ID as integer.
Definition:
WirePlaneId.cxx:21
main
int main()
Definition:
test_wireplaneid.cxx:10
dump_to_simple_cpp.layers
list layers
Definition:
dump_to_simple_cpp.py:29
std
STL namespace.
WireCell::kUnknownLayer
Definition:
WirePlaneId.h:13
Assert
#define Assert
Definition:
Testing.h:7
WireCell::WirePlaneId::ilayer
int ilayer() const
Layer as integer (not index!)
Definition:
WirePlaneId.cxx:29
WirePlaneId.h
Testing.h
WireCell::kVlayer
Definition:
WirePlaneId.h:13
WireCell::WirePlaneId
Definition:
WirePlaneId.h:16
WireCell::WirePlaneId::valid
bool valid() const
return true if valid
Definition:
WirePlaneId.cxx:53
WireCell
Definition:
Main.h:22
WireCell::WirePlaneId::apa
int apa() const
APA number.
Definition:
WirePlaneId.cxx:48
AssertMsg
#define AssertMsg
Definition:
Testing.h:8
WireCell::WirePlaneLayer_t
WirePlaneLayer_t
Enumerate layer IDs. These are not indices!
Definition:
WirePlaneId.h:13
WireCell::kUlayer
Definition:
WirePlaneId.h:13
projectgui.w
w
Definition:
projectgui.py:18
WireCell::kWlayer
Definition:
WirePlaneId.h:13
WireCell::WirePlaneId::index
int index() const
Layer as index number (0,1 or 2). -1 if unknown.
Definition:
WirePlaneId.cxx:34
apa
Definition:
APAGeometryAlg.cxx:37
endl
QTextStream & endl(QTextStream &s)
Definition:
qtextstream.cpp:2030
WireCell::WirePlaneId::face
int face() const
APA face number.
Definition:
WirePlaneId.cxx:44
Generated by
1.8.11