Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
duneprototypes
duneprototypes
Protodune
singlephase
Tool
ProtoduneOnlineChannel_tool.cc
Go to the documentation of this file.
1
// ProtoduneOnlineChannel.cxx
2
3
#include "
ProtoduneOnlineChannel.h
"
4
#include <iostream>
5
#include <vector>
6
7
using
std::string
;
8
using
std::cout;
9
using
std::endl
;
10
using
Index
=
ProtoduneOnlineChannel::Index
;
11
12
//**********************************************************************
13
14
ProtoduneOnlineChannel::ProtoduneOnlineChannel
(
const
fhicl::ParameterSet
&)
15
: m_LogLevel(2) {
16
Index
val
= 0;
17
// Create the maps from the to CCW wire numbers for each plane to
18
// the FEMB channel number.
19
// We follow DUNE DocDB 4064 except numberings start from 0 instead of 1.
20
// ASIC 0
21
uch
[18] = val++;
22
uch
[16] = val++;
23
uch
[14] = val++;
24
uch
[12] = val++;
25
uch
[10] = val++;
26
vch
[18] = val++;
27
vch
[16] = val++;
28
vch
[14] = val++;
29
vch
[12] = val++;
30
vch
[10] = val++;
31
zch
[22] = val++;
32
zch
[20] = val++;
33
zch
[18] = val++;
34
zch
[16] = val++;
35
zch
[14] = val++;
36
zch
[12] = val++;
37
// ASIC 1
38
uch
[ 8] = val++;
39
uch
[ 6] = val++;
40
uch
[ 4] = val++;
41
uch
[ 2] = val++;
42
uch
[ 0] = val++;
43
vch
[ 8] = val++;
44
vch
[ 6] = val++;
45
vch
[ 4] = val++;
46
vch
[ 2] = val++;
47
vch
[ 0] = val++;
48
zch
[10] = val++;
49
zch
[ 8] = val++;
50
zch
[ 6] = val++;
51
zch
[ 4] = val++;
52
zch
[ 2] = val++;
53
zch
[ 0] = val++;
54
// ASIC 2
55
zch
[13] = val++;
56
zch
[15] = val++;
57
zch
[17] = val++;
58
zch
[19] = val++;
59
zch
[21] = val++;
60
zch
[23] = val++;
61
vch
[11] = val++;
62
vch
[13] = val++;
63
vch
[15] = val++;
64
vch
[17] = val++;
65
vch
[19] = val++;
66
uch
[11] = val++;
67
uch
[13] = val++;
68
uch
[15] = val++;
69
uch
[17] = val++;
70
uch
[19] = val++;
71
// ASIC 3
72
zch
[ 1] = val++;
73
zch
[ 3] = val++;
74
zch
[ 5] = val++;
75
zch
[ 7] = val++;
76
zch
[ 9] = val++;
77
zch
[11] = val++;
78
vch
[ 1] = val++;
79
vch
[ 3] = val++;
80
vch
[ 5] = val++;
81
vch
[ 7] = val++;
82
vch
[ 9] = val++;
83
uch
[ 1] = val++;
84
uch
[ 3] = val++;
85
uch
[ 5] = val++;
86
uch
[ 7] = val++;
87
uch
[ 9] = val++;
88
// ASIC 4
89
uch
[28] = val++;
90
uch
[26] = val++;
91
uch
[24] = val++;
92
uch
[22] = val++;
93
uch
[20] = val++;
94
vch
[28] = val++;
95
vch
[26] = val++;
96
vch
[24] = val++;
97
vch
[22] = val++;
98
vch
[20] = val++;
99
zch
[34] = val++;
100
zch
[32] = val++;
101
zch
[30] = val++;
102
zch
[28] = val++;
103
zch
[26] = val++;
104
zch
[24] = val++;
105
// ASIC 5
106
uch
[38] = val++;
107
uch
[36] = val++;
108
uch
[34] = val++;
109
uch
[32] = val++;
110
uch
[30] = val++;
111
vch
[38] = val++;
112
vch
[36] = val++;
113
vch
[34] = val++;
114
vch
[32] = val++;
115
vch
[30] = val++;
116
zch
[46] = val++;
117
zch
[44] = val++;
118
zch
[42] = val++;
119
zch
[40] = val++;
120
zch
[38] = val++;
121
zch
[36] = val++;
122
// ASIC 6
123
zch
[25] = val++;
124
zch
[27] = val++;
125
zch
[29] = val++;
126
zch
[31] = val++;
127
zch
[33] = val++;
128
zch
[35] = val++;
129
vch
[21] = val++;
130
vch
[23] = val++;
131
vch
[25] = val++;
132
vch
[27] = val++;
133
vch
[29] = val++;
134
uch
[21] = val++;
135
uch
[23] = val++;
136
uch
[25] = val++;
137
uch
[27] = val++;
138
uch
[29] = val++;
139
// ASIC 7
140
zch
[37] = val++;
141
zch
[39] = val++;
142
zch
[41] = val++;
143
zch
[43] = val++;
144
zch
[45] = val++;
145
zch
[47] = val++;
146
vch
[31] = val++;
147
vch
[33] = val++;
148
vch
[35] = val++;
149
vch
[37] = val++;
150
vch
[39] = val++;
151
uch
[31] = val++;
152
uch
[33] = val++;
153
uch
[35] = val++;
154
uch
[37] = val++;
155
uch
[39] = val++;
156
if
( val != 128 ) abort();
157
}
158
159
//**********************************************************************
160
161
Index
ProtoduneOnlineChannel::get
(
Index
chanOff)
const
{
162
const
string
myname =
"ProtoduneOnlineChannel::get: "
;
163
if
( chanOff >= 15360 ) {
164
if
(
m_LogLevel
> 1 ) cout << myname <<
"Invalid offline channel: "
<< chanOff <<
endl
;
165
return
badIndex
();
166
}
167
// Get the TPC set.
168
Index
iapa = chanOff/2560;
169
// Get the channel in the apa.
170
Index
ichApa = chanOff%2560;
171
// Get the plane (ipla) and wire number in the plane (ichPla).
172
Index
ipla = 0;
173
Index
ichPla = ichApa;
174
while
( ichPla >=
nwirPlane
[ipla] ) {
175
ichPla -=
nwirPlane
[ipla];
176
++ipla;
177
}
178
// Get the FEMB # in the detector ifmbDet.
179
Index
ifmbApa = ichPla/
nwirFemb
[ipla];
180
if
( ipla == 0 ) {
181
ifmbApa = (ifmbApa + 10) % 20;
182
}
else
if
( ipla == 1 ) {
183
ifmbApa = 19 - ifmbApa;
184
}
else
if
( ipla == 2 ) {
185
ifmbApa = 19 - ifmbApa;
186
}
187
// Get the FEMB number in protoDune (0-119)
188
Index
ifmbDet = 20*iapa + ifmbApa;
189
// Get the wire number in the FEMB.
190
Index
iwchFemb = ichPla %
nwirFemb
[ipla];
// Wire number in the plane and FEMB.
191
if
( iwchFemb >
nwirFemb
[ipla] ) {
192
if
(
m_LogLevel
> 1 ) cout << myname <<
"ERROR: Invalid FEMB channel: "
<< chanOff
193
<<
" --> "
<< iwchFemb <<
endl
;
194
return
badIndex
();
195
}
196
// Note the wire numbers in the channel-to-wire tables increase CCW while
197
// offline is CW for u and z2 and CCW for v and z1.
198
// Flip the wire numbers for the former.
199
if
( ipla == 0 || ipla == 3 ) iwchFemb =
nwirFemb
[ipla] - 1 - iwchFemb;
200
// Find the FEMB channel for the wire.
201
Index
ichFemb = ipla == 0 ?
uch
[iwchFemb] :
202
ipla == 1 ?
vch
[iwchFemb] :
203
zch
[iwchFemb];
204
// Build offline index.
205
Index
ichOn = 128*ifmbDet + ichFemb;
206
return
ichOn;
207
}
208
209
//**********************************************************************
210
211
DEFINE_ART_CLASS_TOOL
(
ProtoduneOnlineChannel
)
ProtoduneOnlineChannel
Definition:
ProtoduneOnlineChannel.h:27
ProtoduneOnlineChannel::get
Index get(Index chanOff) const override
Definition:
ProtoduneOnlineChannel_tool.cc:161
DEFINE_ART_CLASS_TOOL
#define DEFINE_ART_CLASS_TOOL(tool)
Definition:
ToolMacros.h:42
val
Definition:
registry_via_id_test_2.cc:15
ProtoduneOnlineChannel::nwirPlane
Index nwirPlane[4]
Definition:
ProtoduneOnlineChannel.h:40
ProtoduneOnlineChannel::nwirFemb
Index nwirFemb[4]
Definition:
ProtoduneOnlineChannel.h:41
string
std::string string
Definition:
nybbler.cc:12
ProtoduneOnlineChannel::vch
Index vch[40]
Definition:
ProtoduneOnlineChannel.h:43
Index
unsigned int Index
Definition:
sspmapmaker_v1.c:14
ProtoduneOnlineChannel::zch
Index zch[48]
Definition:
ProtoduneOnlineChannel.h:44
ProtoduneOnlineChannel::m_LogLevel
Index m_LogLevel
Definition:
ProtoduneOnlineChannel.h:38
ProtoduneOnlineChannel::ProtoduneOnlineChannel
ProtoduneOnlineChannel(const fhicl::ParameterSet &ps)
Definition:
ProtoduneOnlineChannel_tool.cc:14
ProtoduneOnlineChannel::uch
Index uch[40]
Definition:
ProtoduneOnlineChannel.h:42
IndexMapTool::Index
unsigned int Index
Definition:
IndexMapTool.h:16
IndexMapTool::badIndex
static Index badIndex()
Definition:
IndexMapTool.h:18
ProtoduneOnlineChannel.h
endl
QTextStream & endl(QTextStream &s)
Definition:
qtextstream.cpp:2030
fhicl::ParameterSet
Definition:
ParameterSet.h:36
Generated by
1.8.11