ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
TrigT1TGC
src
TGCSlaveBoardOut.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
TrigT1TGC/TGCSlaveBoardOut.h
"
6
#include "
TrigT1TGC/TGCSlaveBoard.h
"
7
8
namespace
LVL1TGCTrigger
{
9
10
TGCSlaveBoardOut::TGCSlaveBoardOut
(
const
TGCSlaveBoard
* sb,
int
bidIn)
11
:
m_origin
(sb),
m_bid
(bidIn),
m_orgBoardType
(-1),
m_orgSBid
(-1),
12
m_numberOfData
(0)
13
{
14
for
(
int
i=0; i<
s_MaxNumberOfSBData
; i++) {
15
m_bpos
[i]=0;
16
m_dev
[i] =0;
17
m_pos
[i] =0;
18
m_hit
[i] =
false
;
19
}
20
for
(
int
i=0; i<2; i++)
m_bdev
[i]=0;
// 2=TotalNumberOfOutputData[1]
21
22
if
(!
m_origin
)
return
;
23
24
m_orgBoardType
=
m_origin
->getType();
//type = 0,1,2,3 : WT,WD,ST,SD
25
m_orgSBid
=
m_origin
->getId();
26
27
for
(
int
i=0; i <
TotalNumberOfOutputData
[
m_orgBoardType
]; i++) {
28
m_bpos
[i] =
new
TGCHitPattern
(
posSize
[
m_orgBoardType
]);
29
}
30
if
((
m_orgBoardType
==
SDSB
) || (
m_orgBoardType
==
WDSB
)){
31
for
(
int
i=0; i<
TotalNumberOfOutputData
[1]; i++) {
32
m_bdev
[i] =
new
TGCHitPattern
(1);
33
}
34
}
35
}
36
37
TGCSlaveBoardOut
&
TGCSlaveBoardOut::operator=
(
const
TGCSlaveBoardOut
& right)
38
{
39
if
(
this
!= &right){
40
for
(
int
i=0; i<
s_MaxNumberOfSBData
; i++) {
41
delete
m_bpos
[i];
42
m_bpos
[i]=0;
43
m_dev
[i] =0;
44
m_pos
[i] =0;
45
m_hit
[i] =
false
;
46
}
47
for
(
int
i=0; i<2; i++) {
// 2=TotalNumberOfOutputData[1]
48
delete
m_bdev
[i];
49
m_bdev
[i]=0;
50
}
51
52
m_origin
= right.
m_origin
;
53
m_bid
= right.
m_bid
;
54
m_orgBoardType
= right.
m_orgBoardType
;
55
m_orgSBid
= right.
m_orgSBid
;
56
m_numberOfData
= right.
m_numberOfData
;
57
58
if
(
m_orgBoardType
>=0) {
59
for
(
int
i=0; i <
TotalNumberOfOutputData
[
m_orgBoardType
]; i++) {
60
m_bpos
[i] =
new
TGCHitPattern
(*(right.
m_bpos
[i]));
61
m_dev
[i] = right.
m_dev
[i];
62
m_pos
[i] = right.
m_pos
[i];
63
m_hit
[i] = right.
m_hit
[i];
64
}
65
if
((
m_orgBoardType
==
SDSB
) || (
m_orgBoardType
==
WDSB
)){
66
for
(
int
i=0; i<
TotalNumberOfOutputData
[1]; i++) {
67
m_bdev
[i] =
new
TGCHitPattern
(*(right.
m_bdev
[i]));
68
}
69
}
70
}
71
}
72
return
*
this
;
73
}
74
75
TGCSlaveBoardOut::TGCSlaveBoardOut
(
const
TGCSlaveBoardOut
& right)
76
:
m_origin
(right.
m_origin
),
m_bid
(right.
m_bid
),
77
m_orgBoardType
(-1),
m_orgSBid
(-1),
78
m_numberOfData
(right.
m_numberOfData
)
79
{
80
for
(
int
i=0; i<
s_MaxNumberOfSBData
; i++) {
81
m_bpos
[i]=0;
82
m_dev
[i] =0;
83
m_pos
[i] =0;
84
m_hit
[i] =
false
;
85
}
86
for
(
int
i=0; i<2; i++)
m_bdev
[i]=0;
// 2=TotalNumberOfOutputData[1]
87
88
if
(!
m_origin
)
return
;
89
90
m_orgBoardType
=
m_origin
->getType();
//type = 0,1,2,3 : WT,WD,ST,SD
91
m_orgSBid
=
m_origin
->getId();
92
93
for
(
int
i=0; i <
TotalNumberOfOutputData
[
m_orgBoardType
]; i++) {
94
m_bpos
[i] =
new
TGCHitPattern
(*(right.
m_bpos
[i]));
95
m_dev
[i] = right.
m_dev
[i];
96
m_pos
[i] = right.
m_pos
[i];
97
m_hit
[i] = right.
m_hit
[i];
98
}
99
if
((
m_orgBoardType
==
SDSB
) || (
m_orgBoardType
==
WDSB
)){
100
for
(
int
i=0; i<
TotalNumberOfOutputData
[1]; i++) {
101
m_bdev
[i] =
new
TGCHitPattern
(*(right.
m_bdev
[i]));
102
}
103
}
104
}
105
106
TGCSlaveBoardOut::TGCSlaveBoardOut
()
107
:
m_origin
(0),
m_bid
(-1),
108
m_orgBoardType
(-1),
m_orgSBid
(-1),
109
m_numberOfData
(0)
110
{
111
for
(
int
i=0; i<
s_MaxNumberOfSBData
; i++) {
112
m_bpos
[i]=0;
113
m_dev
[i] =0;
114
m_pos
[i] =0;
115
m_hit
[i] =
false
;
116
}
117
for
(
int
i=0; i<2
/* 2=TotalNumberOfOutputData[1] */
; i++)
m_bdev
[i]=0;
118
}
119
120
TGCSlaveBoardOut::~TGCSlaveBoardOut
()
121
{
122
for
(
int
i=0; i<
TotalNumberOfOutputData
[
m_orgBoardType
]; i++) {
123
if
(
m_bpos
[i]) {
124
delete
m_bpos
[i];
125
m_bpos
[i] = 0;
126
}
127
}
128
for
(
int
i=0; i<
TotalNumberOfOutputData
[1]; i++) {
129
if
(
m_bdev
[i]){
130
delete
m_bdev
[i];
131
m_bdev
[i] = 0;
132
}
133
}
134
}
135
136
137
138
void
TGCSlaveBoardOut::setbDev
(
int
block,
int
sign
,
int
dr)
139
{
140
if
(block >=
TotalNumberOfOutputData
[
m_orgBoardType
]){
141
std::cerr <<
"TGCSlaveBoardOut::setbDev : illegal block "
142
<<
" Type="
<<
m_orgBoardType
<<
" #block="
<<
TotalNumberOfOutputData
[
m_orgBoardType
]
143
<<
" block="
<< block << std::endl;
144
return
;
145
}
146
if
((
m_orgBoardType
!=
SDSB
) && (
m_orgBoardType
!=
WDSB
)){
147
std::cerr <<
"TGCSlaveBoardOut::setbDev : illegal Type "
148
<<
" Type="
<<
m_orgBoardType
<<
" #block="
<<
TotalNumberOfOutputData
[
m_orgBoardType
]
149
<<
" block="
<< block << std::endl;
150
return
;
151
}
152
153
TGCHitPattern
tmp(3);
154
tmp.dec2bin(dr);
155
#ifdef TGCDEBUG
156
tmp.printb();
157
std::cout <<
":"
<< dr <<
" TGCSlaveBoardOut::setbDev"
<< std::endl;
158
#endif
159
if
(0 <=
sign
*dr) {
160
m_bdev
[block]->setChannel(0,
true
);
161
}
else
{
162
m_bdev
[block]->setChannel(0,
false
);
163
}
164
m_bdev
[block]->push_back(&tmp);
165
#ifdef TGCDEBUG
166
m_bdev
[block]->printb();
167
std::cout << std::endl;
168
#endif
169
}
170
171
void
TGCSlaveBoardOut::setPos
(
int
iData,
int
posIn)
172
{
173
if
(
s_MaxNumberOfSBData
<= iData) {
174
std::cerr <<
"internal error TGCSlaveBoardOut::setPos()"
<< std::endl;
175
}
else
{
176
m_pos
[iData] = posIn;
177
}
178
}
179
180
181
void
TGCSlaveBoardOut::clear
()
182
{
183
int
i;
184
m_numberOfData
=0;
185
for
( i=0; i<
s_MaxNumberOfSBData
; i+=1)
186
{
187
m_hit
[i]=
false
;
188
m_pos
[i]=-1;
189
m_dev
[i]=-99;
190
}
191
}
192
193
void
TGCSlaveBoardOut::print
()
const
194
{
195
#ifdef TGCCOUT
196
int
OutPutBlock;
197
std::cout<<
" SlaveBoardOut:"
;
198
std::cout<<
" SBID:"
<<
m_orgSBid
;
199
200
switch
(
m_orgBoardType
)
201
{
202
case
WTSB
:
203
std::cout<<
" SBType:"
<<
"WTSB"
;
204
break
;
205
case
WDSB
:
206
std::cout<<
" SBType:"
<<
"WDSB"
;
207
break
;
208
case
STSB
:
209
std::cout<<
" SBType:"
<<
"STSB"
;
210
break
;
211
case
SDSB
:
212
std::cout<<
" SBType:"
<<
"SDSB"
;
213
break
;
214
}
215
std::cout<<
" bid:"
<<
m_bid
;
216
for
( OutPutBlock=0; OutPutBlock<
m_numberOfData
; OutPutBlock+=1)
217
if
(
m_hit
[OutPutBlock]) std::cout <<
" [OutPutBlock="
<< OutPutBlock <<
" x="
<<
m_pos
[OutPutBlock] <<
" d="
<<
m_dev
[OutPutBlock] <<
"]"
;
218
std::cout<<std::endl;
219
220
int
count
= 0;
221
for
( OutPutBlock=0; OutPutBlock<
m_numberOfData
; OutPutBlock+=1)
222
{
223
if
(
m_hit
[OutPutBlock] &&
m_bpos
[OutPutBlock])
224
{
225
count
++;
226
std::cout <<
" bit pattern [OutPutBlock="
<< OutPutBlock <<
" x="
;
227
m_bpos
[OutPutBlock]->printb();
228
if
(((
m_orgBoardType
==
SDSB
) || (
m_orgBoardType
==
WDSB
)) &&
m_bdev
[OutPutBlock])
229
{
230
std::cout <<
" d="
;
231
m_bdev
[OutPutBlock]->printb();
232
}
233
std::cout <<
"]"
;
234
}
235
}
236
if
(
count
)std::cout<<std::endl;
237
#endif
238
}
239
240
#ifdef TGCCOUT
241
void
TGCSlaveBoardOut::print
(
int
OutPutBlock )
const
242
#else
243
void
TGCSlaveBoardOut::print
(
int
/*OutPutBlock*/
)
const
244
#endif
245
{
246
#ifdef TGCCOUT
247
std::cout<<
" SlaveBoardOut:"
;
248
std::cout<<
" SBID:"
<<
m_orgSBid
;
249
#endif
250
switch
(
m_orgBoardType
)
251
{
252
case
WTSB
:
253
#ifdef TGCCOUT
254
std::cout<<
" SBType:"
<<
"WTSB"
;
255
#endif
256
break
;
257
case
WDSB
:
258
#ifdef TGCCOUT
259
std::cout<<
" SBType:"
<<
"WDSB"
;
260
#endif
261
break
;
262
case
STSB
:
263
#ifdef TGCCOUT
264
std::cout<<
" SBType:"
<<
"STSB"
;
265
#endif
266
break
;
267
case
SDSB
:
268
#ifdef TGCCOUT
269
std::cout<<
" SBType:"
<<
"SDSB"
;
270
#endif
271
break
;
272
}
273
#ifdef TGCCOUT
274
std::cout<<
" bid:"
<<
m_bid
;
275
if
(
m_hit
[OutPutBlock]) std::cout <<
" [OutPutBlock="
<< OutPutBlock <<
" x="
<<
m_pos
[OutPutBlock] <<
" d="
<<
m_dev
[OutPutBlock] <<
"]"
;
276
277
if
(
m_hit
[OutPutBlock] &&
m_bpos
[OutPutBlock])
278
{
279
std::cout <<
" bit pattern [OutPutBlock="
<< OutPutBlock <<
" x="
;
280
m_bpos
[OutPutBlock]->printb();
281
if
(((
m_orgBoardType
==
SDSB
) || (
m_orgBoardType
==
WDSB
)) &&
m_bdev
[OutPutBlock])
282
{
283
std::cout <<
" d="
;
284
m_bdev
[OutPutBlock]->printb();
285
}
286
std::cout <<
"]"
;
287
}
288
std::cout<<std::endl;
289
#endif
290
}
291
292
void
TGCSlaveBoardOut::print
(std::ofstream* ofs)
const
293
{
294
int
OutPutBlock;
295
bool
tHit =
false
;
296
297
for
(OutPutBlock = 0; OutPutBlock <
m_numberOfData
; OutPutBlock++)
298
if
(
m_hit
[OutPutBlock] &&
m_bpos
[OutPutBlock])
299
tHit =
true
;
300
if
(!tHit)
return
;
301
302
*ofs <<
"#SlaveBoardOut:"
;
303
*ofs <<
" SBID:"
<<
m_orgSBid
;
304
305
switch
(
m_orgBoardType
)
306
{
307
case
WTSB
:
308
*ofs <<
" SBType:"
<<
"WTSB"
;
309
break
;
310
case
WDSB
:
311
*ofs <<
" SBType:"
<<
"WDSB"
;
312
break
;
313
case
STSB
:
314
*ofs <<
" SBType:"
<<
"STSB"
;
315
break
;
316
case
SDSB
:
317
*ofs <<
" SBType:"
<<
"SDSB"
;
318
break
;
319
}
320
*ofs <<
" bid:"
<<
m_bid
;
321
for
(OutPutBlock = 0; OutPutBlock <
m_numberOfData
; OutPutBlock++)
322
if
(
m_hit
[OutPutBlock] &&
m_bpos
[OutPutBlock])
323
{
324
*ofs <<
" [OutPutBlock="
<< OutPutBlock <<
"/"
<<
m_numberOfData
-1 <<
" x="
<<
m_pos
[OutPutBlock] <<
" d="
<<
m_dev
[OutPutBlock] <<
"]"
;
325
*ofs <<
"[OutPutBlock="
<< OutPutBlock <<
" x="
;
326
m_bpos
[OutPutBlock]->printb(ofs);
327
if
(((
m_orgBoardType
==
SDSB
) || (
m_orgBoardType
==
WDSB
)) &&
m_bdev
[OutPutBlock])
328
{
329
*ofs <<
" d="
;
330
m_bdev
[OutPutBlock]->printb(ofs);
331
}
332
*ofs <<
"]"
;
333
}
334
*ofs << std::endl;
335
}
336
337
void
TGCSlaveBoardOut::print
(std::ofstream* ofs,
int
OutPutBlock)
const
338
{
339
if
(!(
m_hit
[OutPutBlock] &&
m_bpos
[OutPutBlock]))
return
;
340
341
*ofs <<
"#SlaveBoardOut:"
;
342
*ofs <<
" SBID:"
<<
m_orgSBid
;
343
344
switch
(
m_orgBoardType
)
345
{
346
case
WTSB
:
347
*ofs <<
" SBType:"
<<
"WTSB"
;
348
break
;
349
case
WDSB
:
350
*ofs <<
" SBType:"
<<
"WDSB"
;
351
break
;
352
case
STSB
:
353
*ofs <<
" SBType:"
<<
"STSB"
;
354
break
;
355
case
SDSB
:
356
*ofs <<
" SBType:"
<<
"SDSB"
;
357
break
;
358
}
359
*ofs <<
" bid:"
<<
m_bid
;
360
if
(
m_hit
[OutPutBlock] &&
m_bpos
[OutPutBlock])
361
{
362
*ofs <<
" [OutPutBlock="
<< OutPutBlock <<
" x="
<<
m_pos
[OutPutBlock] <<
" d="
<<
m_dev
[OutPutBlock] <<
"]"
;
363
*ofs <<
"[OutPutBlock="
<< OutPutBlock;
364
*ofs <<
" x="
;
365
m_bpos
[OutPutBlock]->printb(ofs);
366
if
(((
m_orgBoardType
==
SDSB
) || (
m_orgBoardType
==
WDSB
)) &&
m_bdev
[OutPutBlock])
367
{
368
*ofs <<
" d="
;
369
m_bdev
[OutPutBlock]->printb(ofs);
370
}
371
*ofs <<
"]"
;
372
}
373
*ofs << std::endl;
374
}
375
376
void
TGCSlaveBoardOut::printpattern
(std::ofstream* ofs)
const
377
{
378
int
OutPutBlock;
379
380
for
(OutPutBlock = 0; OutPutBlock <
m_numberOfData
; OutPutBlock++)
381
if
(
m_hit
[OutPutBlock] &&
m_bpos
[OutPutBlock])
382
{
383
*ofs <<
" "
;
384
if
((
m_orgBoardType
==
WTSB
)|| (
m_orgBoardType
==
STSB
))
385
{
386
*ofs <<
"1"
;
//m_hit
387
}
388
m_bpos
[OutPutBlock]->printb(ofs);
389
if
(((
m_orgBoardType
==
SDSB
) || (
m_orgBoardType
==
WDSB
)) &&
m_bdev
[OutPutBlock])
390
{
391
*ofs <<
" "
;
392
m_bdev
[OutPutBlock]->printb(ofs);
393
}
394
}
395
else
396
{
397
if
((
m_orgBoardType
==
SDSB
) || (
m_orgBoardType
==
WDSB
))
398
{
399
*ofs <<
" 00000 0000"
;
400
}
401
else
if
(
m_orgBoardType
==
WTSB
)
402
{
403
*ofs <<
" 000000"
;
404
}
405
else
406
{
407
*ofs <<
" 00000"
;
408
}
409
}
410
}
411
412
void
TGCSlaveBoardOut::printpattern
(std::ofstream* ofs,
int
OutPutBlock)
const
413
{
414
if
(
m_hit
[OutPutBlock] &&
m_bpos
[OutPutBlock])
415
{
416
*ofs <<
" "
;
417
if
((
m_orgBoardType
==
WTSB
) || (
m_orgBoardType
==
STSB
))
418
{
419
*ofs <<
"1"
;
//m_hit
420
}
421
m_bpos
[OutPutBlock]->printb(ofs);
422
if
(((
m_orgBoardType
==
SDSB
) || (
m_orgBoardType
==
WDSB
)) &&
m_bdev
[OutPutBlock])
423
{
424
*ofs <<
" "
;
425
m_bdev
[OutPutBlock]->printb(ofs);
426
}
427
}
428
else
429
{
430
if
((
m_orgBoardType
==
SDSB
) || (
m_orgBoardType
==
WDSB
))
431
{
432
*ofs <<
" 00000 0000"
;
433
}
434
else
if
(
m_orgBoardType
==
WTSB
)
435
{
436
*ofs <<
" 000000"
;
437
}
438
else
439
{
440
*ofs <<
" 00000"
;
441
}
442
}
443
}
444
445
}
//end of namespace bracket
TGCSlaveBoardOut.h
TGCSlaveBoard.h
sign
int sign(int a)
Definition
TRT_StrawNeighbourSvc.h:108
LVL1TGCTrigger::TGCHitPattern
Definition
TGCHitPattern.h:11
LVL1TGCTrigger::TGCSlaveBoardOut::m_hit
bool m_hit[s_MaxNumberOfSBData]
Definition
TGCSlaveBoardOut.h:66
LVL1TGCTrigger::TGCSlaveBoardOut::m_bpos
TGCHitPattern * m_bpos[s_MaxNumberOfSBData]
Definition
TGCSlaveBoardOut.h:68
LVL1TGCTrigger::TGCSlaveBoardOut::m_origin
const TGCSlaveBoard * m_origin
Definition
TGCSlaveBoardOut.h:58
LVL1TGCTrigger::TGCSlaveBoardOut::~TGCSlaveBoardOut
~TGCSlaveBoardOut()
Definition
TGCSlaveBoardOut.cxx:120
LVL1TGCTrigger::TGCSlaveBoardOut::s_MaxNumberOfSBData
static constexpr int s_MaxNumberOfSBData
Definition
TGCSlaveBoardOut.h:56
LVL1TGCTrigger::TGCSlaveBoardOut::m_dev
int m_dev[s_MaxNumberOfSBData]
Definition
TGCSlaveBoardOut.h:64
LVL1TGCTrigger::TGCSlaveBoardOut::TGCSlaveBoardOut
TGCSlaveBoardOut()
Definition
TGCSlaveBoardOut.cxx:106
LVL1TGCTrigger::TGCSlaveBoardOut::m_orgSBid
int m_orgSBid
Definition
TGCSlaveBoardOut.h:61
LVL1TGCTrigger::TGCSlaveBoardOut::operator=
TGCSlaveBoardOut & operator=(const TGCSlaveBoardOut &)
Definition
TGCSlaveBoardOut.cxx:37
LVL1TGCTrigger::TGCSlaveBoardOut::m_bid
int m_bid
Definition
TGCSlaveBoardOut.h:59
LVL1TGCTrigger::TGCSlaveBoardOut::TGCSlaveBoardOut
TGCSlaveBoardOut(const TGCSlaveBoard *sb, int bidIn)
Definition
TGCSlaveBoardOut.cxx:10
LVL1TGCTrigger::TGCSlaveBoardOut::print
void print() const
Definition
TGCSlaveBoardOut.cxx:193
LVL1TGCTrigger::TGCSlaveBoardOut::m_orgBoardType
int m_orgBoardType
Definition
TGCSlaveBoardOut.h:60
LVL1TGCTrigger::TGCSlaveBoardOut::m_pos
int m_pos[s_MaxNumberOfSBData]
Definition
TGCSlaveBoardOut.h:65
LVL1TGCTrigger::TGCSlaveBoardOut::m_numberOfData
int m_numberOfData
Definition
TGCSlaveBoardOut.h:63
LVL1TGCTrigger::TGCSlaveBoardOut::m_bdev
TGCHitPattern * m_bdev[2]
Definition
TGCSlaveBoardOut.h:69
LVL1TGCTrigger::TGCSlaveBoardOut::setPos
void setPos(int iData, int posIn)
Definition
TGCSlaveBoardOut.cxx:171
LVL1TGCTrigger::TGCSlaveBoardOut::clear
void clear()
Definition
TGCSlaveBoardOut.cxx:181
LVL1TGCTrigger::TGCSlaveBoardOut::printpattern
void printpattern(std::ofstream *ofs) const
Definition
TGCSlaveBoardOut.cxx:376
LVL1TGCTrigger::TGCSlaveBoardOut::setbDev
void setbDev(int block, int sign, int dr)
Definition
TGCSlaveBoardOut.cxx:138
LVL1TGCTrigger::TGCSlaveBoard
Definition
TGCSlaveBoard.h:22
count
int count(std::string s, const std::string ®x)
count how many occurances of a regx are in a string
Definition
hcg.cxx:148
LVL1TGCTrigger
Definition
LVL1TGCTrigger.cxx:48
LVL1TGCTrigger::TotalNumberOfOutputData
const int TotalNumberOfOutputData[6]
Definition
TGCSlaveBoardOut.h:18
LVL1TGCTrigger::posSize
const int posSize[6]
Definition
TGCSlaveBoardOut.h:15
LVL1TGCTrigger::WTSB
@ WTSB
Definition
TGCNumbering.h:57
LVL1TGCTrigger::STSB
@ STSB
Definition
TGCNumbering.h:57
LVL1TGCTrigger::SDSB
@ SDSB
Definition
TGCNumbering.h:57
LVL1TGCTrigger::WDSB
@ WDSB
Definition
TGCNumbering.h:57
Generated on
for ATLAS Offline Software by
1.17.0