ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
TrigT1Interfaces
src
Lvl1MuForwardSectorLogicDataPhase1.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3
*/
4
#include <iomanip>
5
#include <iostream>
6
7
#include "
TrigT1Interfaces/Lvl1MuForwardSectorLogicDataPhase1.h
"
8
#include "
TrigT1Interfaces/Lvl1MuSectorLogicConstantsPhase1.h
"
9
10
namespace
LVL1MUONIF
{
11
12
Lvl1MuForwardSectorLogicDataPhase1::Lvl1MuForwardSectorLogicDataPhase1
()
13
:
Lvl1MuSectorLogicDataPhase1
() {
14
m_id_system
= 2;
15
initialize
();
16
}
17
18
Lvl1MuForwardSectorLogicDataPhase1
&
Lvl1MuForwardSectorLogicDataPhase1::operator=
(
const
Lvl1MuSectorLogicDataPhase1
& right ) {
19
if
( ( right.
getSystemId
() ==
m_id_system
) &&
20
(
this
!= &right ) ) {
21
m_bcid
= right.
bcid
();
22
m_nsw
= right.
nsw
();
23
m_2candidatesInSector
= right.
is2candidatesInSector
();
24
for
(
size_t
i = 0; i <
NCAND
[
m_id_system
]; ++i ) {
25
m_roi
[ i ] = right.
roi
( i );
26
m_ovl
[ i ] = right.
ovl
( i );
27
m_pt
[ i ] = right.
pt
( i );
28
m_charge
[ i ] = right.
charge
( i );
29
m_2candidates
[ i ] = right.
is2candidates
( i );
30
m_goodmf
[ i ] = right.
goodmf
(i);
31
m_innercoin
[ i ] = right.
innercoin
(i);
32
m_bw2or3
[ i ] = right.
bw2or3
(i);
33
m_veto
[ i ] = right.
veto
(i);
34
}
35
}
36
return
*
this
;
37
}
38
39
Lvl1MuSectorLogicDataPhase1::SectorLogicWord
Lvl1MuForwardSectorLogicDataPhase1::getWordFormat
()
const
{
40
41
SectorLogicWord
val(std::make_pair(0, 0));
42
unsigned
int
len=0;
43
unsigned
int
pos=0;
44
for
(
size_t
i=0;i<
NCAND
[
m_id_system
];i++)
45
{
46
//track current position and length of current data
47
len=0;
48
pos=0;
49
50
// Candidate 'i' will be offset by 16*i bits
51
//0-7: ROI - 8 bits
52
len=
NBITS_ROI
[
m_id_system
];
53
if
(
roi
(i) < 0) val.first |= len << (i*16+pos);
54
else
val.first |= (
roi
(i) & len) << (i*16+pos);
55
pos += len;
56
57
//8-11: pT - 4 bits
58
len=
NBITS_PT
[
m_id_system
];
59
val.first |= (
pt
(i) & len) << (i*16+pos);
60
pos += len;
61
62
//12: charge
63
len=
NBITS_CHARGE
[
m_id_system
];
64
val.first |= (
charge
(i) & len) << (i*16+pos);
65
pos += len;
66
67
//13: 2 or 3 hits in BW
68
len=
NBITS_BW2OR3
[
m_id_system
];
69
val.first |= (
bw2or3
(i) & len) << (i*16+pos);
70
pos += len;
71
72
//14: inner coincidence
73
len=
NBITS_CHARGE
[
m_id_system
];
74
if
(
charge
(i) > 0) val.first |= (1 >> (i*16+pos)) & len;
75
pos += len;
76
77
//15: GoodMF
78
len=
NBITS_GOODMF
[
m_id_system
];
79
val.first |= (
goodmf
(i) & len) << (i*16+pos);
80
pos += len;
81
}
82
83
84
// Global+BCID flags (bits 32-47)
85
len=0;
86
pos=0;
87
88
//0-11: BCID
89
len=
NBITS_BCID
[
m_id_system
];
90
val.second |= (
bcid
() & len);
91
pos += len;
92
93
//12-15: global flags
94
//12: >1cand/sector
95
len=
NBITS_IS2CANDIDATESINSECTOR
[
m_id_system
];
96
if
(
is2candidatesInSector
()) val.second |= (1 >> pos) & len;
97
pos += len;
98
99
//13: nsw monitoring
100
len=
NBITS_NSWMON
[
m_id_system
];
101
if
(
nsw
()) val.second |= (1 >> pos) & len;
102
pos += len;
103
104
105
return
val;
106
}
107
108
109
const
Lvl1MuSectorLogicDataPhase1
&
Lvl1MuForwardSectorLogicDataPhase1::convertFromWordFormat
(
const
SectorLogicWord
& value ) {
110
111
unsigned
int
val;
112
unsigned
int
pos=0;
113
unsigned
int
len=0;
114
for
(
size_t
i=0;i<
NCAND
[
m_id_system
];i++)
115
{
116
//track current position and length of current data
117
len=0;
118
pos=0;
119
120
// Candidate 'i' will be offset by 16*i bits
121
//0-7: ROI - 8 bits
122
len=
NBITS_ROI
[
m_id_system
];
123
val = (value.first >> (i*16+pos)) & len;
124
if
(val == len)
roi
(i, -1);
125
else
roi
(i, val);
126
pos += len;
127
128
//8-11: pT - 4 bits
129
len=
NBITS_PT
[
m_id_system
];
130
val = (value.first >> (i*16+pos)) & len;
131
if
(val == len)
pt
(i, -1);
132
else
pt
(i, val);
133
pos += len;
134
135
//12: charge
136
len=
NBITS_CHARGE
[
m_id_system
];
137
val = (value.first >> (i*16+pos)) & len;
138
if
(val > 0)
charge
(i, +1);
139
else
charge
(i, -1);
140
pos += len;
141
142
//13: 2 or 3 hits in BW
143
len=
NBITS_BW2OR3
[
m_id_system
];
144
val = (value.first >> (i*16+pos)) & len;
145
bw2or3
(i, val);
146
pos += len;
147
148
//14: inner coincidence
149
len=
NBITS_INNERCOIN
[
m_id_system
];
150
val = (value.first >> (i*16+pos)) & len;
151
innercoin
(i, val);
152
pos += len;
153
154
//15: GoodMF
155
len=
NBITS_GOODMF
[
m_id_system
];
156
val = (value.first >> (i*16+pos)) & len;
157
goodmf
(i, val);
158
pos += len;
159
}
160
161
// Global+BCID flags (bits 32-47)
162
len=0;
163
pos=0;
164
165
//0-11: BCID
166
len=
NBITS_BCID
[
m_id_system
];
167
val = value.second & len;
168
bcid
(val);
169
pos += len;
170
171
//12: > 2 candidates
172
len=
NBITS_IS2CANDIDATESINSECTOR
[
m_id_system
];
173
val = (value.second >> pos) & len;
174
if
(val)
set2candidatesInSector
();
175
else
clear2candidatesInSector
();
176
177
//13: nsw monitoring
178
len=
NBITS_NSWMON
[
m_id_system
];
179
val = (value.second >> pos) & len;
180
nsw
(val);
181
182
//14-15: other global flags
183
184
return
*
this
;
185
}
186
187
188
void
Lvl1MuForwardSectorLogicDataPhase1::printOut
( std::ostream& out )
const
{
189
190
for
(
size_t
i=0;i<
NCAND
[
m_id_system
];i++)
191
{
192
out <<
"Bit 0-7 "
<<
" ROI<"
<< i+1 <<
"> "
;
193
if
(
roi
(i) == -1) out <<
"NA"
<< std::endl;
194
else
out << std::setw(8) <<
roi
(i) << std::endl;
195
196
out <<
"Bit 8-11 "
<<
"Pt"
<< i+1 <<
" "
;
197
if
(
pt
(i) == -1) out <<
"No Hit"
<< std::endl;
198
else
out <<
pt
(i) << std::endl;
199
200
out <<
"Bit 12 "
<<
"2 candidates in ROI<"
<< i+1 <<
"> "
;
201
out << std::setw(8) <<
is2candidates
(i) << std::endl;
202
203
out <<
"Bit 13-14 "
<<
"overlap<"
<<i+1<<
"> "
;
204
out << std::setw(8) <<
ovl
(i) << std::endl;
205
206
out <<
"Bit 15 "
<<
"charge<"
<<i+1<<
"> "
;
207
out << std::setw(8) <<
charge
(i) << std::endl;
208
}
209
out <<
"Bit 0-11 "
<<
" BCID "
;
210
out << std::setw( 8 ) <<
bcid
() << std::endl;
211
212
out <<
"Bit 12 "
<<
" >2candidates in a sector "
;
213
out << std::setw( 8 ) <<
m_2candidatesInSector
<< std::endl;
214
215
out <<
"Bit 13 "
<<
" NSW monitoring "
;
216
out << std::setw( 8 ) <<
m_nsw
<< std::endl;
217
}
218
219
}
// namespace LVL1MUONIF
Lvl1MuForwardSectorLogicDataPhase1.h
Lvl1MuSectorLogicConstantsPhase1.h
LVL1MUONIF::Lvl1MuForwardSectorLogicDataPhase1::convertFromWordFormat
const Lvl1MuSectorLogicDataPhase1 & convertFromWordFormat(const SectorLogicWord &)
Convert SectorLogicDataPhase1 from 32 bit word data.
Definition
Lvl1MuForwardSectorLogicDataPhase1.cxx:109
LVL1MUONIF::Lvl1MuForwardSectorLogicDataPhase1::getWordFormat
SectorLogicWord getWordFormat() const
Get data in 32 bit word format.
Definition
Lvl1MuForwardSectorLogicDataPhase1.cxx:39
LVL1MUONIF::Lvl1MuForwardSectorLogicDataPhase1::Lvl1MuForwardSectorLogicDataPhase1
Lvl1MuForwardSectorLogicDataPhase1()
Definition
Lvl1MuForwardSectorLogicDataPhase1.cxx:12
LVL1MUONIF::Lvl1MuForwardSectorLogicDataPhase1::operator=
Lvl1MuForwardSectorLogicDataPhase1 & operator=(const Lvl1MuSectorLogicDataPhase1 &right)
Definition
Lvl1MuForwardSectorLogicDataPhase1.cxx:18
LVL1MUONIF::Lvl1MuForwardSectorLogicDataPhase1::printOut
virtual void printOut(std::ostream &out) const
print out data
Definition
Lvl1MuForwardSectorLogicDataPhase1.cxx:188
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::m_id_system
int m_id_system
Definition
Lvl1MuSectorLogicDataPhase1.h:99
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::is2candidatesInSector
bool is2candidatesInSector() const
Definition
Lvl1MuSectorLogicDataPhase1.h:47
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::m_innercoin
std::vector< int > m_innercoin
Definition
Lvl1MuSectorLogicDataPhase1.h:101
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::m_roi
std::vector< int > m_roi
Definition
Lvl1MuSectorLogicDataPhase1.h:92
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::roi
int roi(size_t id) const
Definition
Lvl1MuSectorLogicDataPhase1.h:50
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::goodmf
int goodmf(size_t id) const
Definition
Lvl1MuSectorLogicDataPhase1.h:55
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::bw2or3
int bw2or3(size_t id) const
Definition
Lvl1MuSectorLogicDataPhase1.h:57
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::charge
int charge(size_t id) const
Definition
Lvl1MuSectorLogicDataPhase1.h:53
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::m_2candidates
std::vector< bool > m_2candidates
Definition
Lvl1MuSectorLogicDataPhase1.h:95
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::is2candidates
bool is2candidates(size_t id) const
Definition
Lvl1MuSectorLogicDataPhase1.h:54
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::innercoin
int innercoin(size_t id) const
Definition
Lvl1MuSectorLogicDataPhase1.h:56
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::m_goodmf
std::vector< int > m_goodmf
Definition
Lvl1MuSectorLogicDataPhase1.h:100
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::clear2candidatesInSector
void clear2candidatesInSector()
Definition
Lvl1MuSectorLogicDataPhase1.h:61
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::nsw
int nsw() const
Definition
Lvl1MuSectorLogicDataPhase1.h:49
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::m_2candidatesInSector
bool m_2candidatesInSector
Definition
Lvl1MuSectorLogicDataPhase1.h:91
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::m_charge
std::vector< int > m_charge
Definition
Lvl1MuSectorLogicDataPhase1.h:98
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::m_bw2or3
std::vector< int > m_bw2or3
Definition
Lvl1MuSectorLogicDataPhase1.h:102
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::m_nsw
int m_nsw
Definition
Lvl1MuSectorLogicDataPhase1.h:97
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::m_ovl
std::vector< int > m_ovl
Definition
Lvl1MuSectorLogicDataPhase1.h:93
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::set2candidatesInSector
void set2candidatesInSector()
Definition
Lvl1MuSectorLogicDataPhase1.h:60
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::veto
int veto(size_t id) const
Definition
Lvl1MuSectorLogicDataPhase1.h:58
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::initialize
void initialize()
Definition
Lvl1MuSectorLogicDataPhase1.cxx:35
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::ovl
int ovl(size_t id) const
Definition
Lvl1MuSectorLogicDataPhase1.h:51
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::m_pt
std::vector< int > m_pt
Definition
Lvl1MuSectorLogicDataPhase1.h:94
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::m_veto
std::vector< int > m_veto
Definition
Lvl1MuSectorLogicDataPhase1.h:103
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::SectorLogicWord
std::pair< unsigned long int, unsigned short int > SectorLogicWord
Definition
Lvl1MuSectorLogicDataPhase1.h:45
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::Lvl1MuSectorLogicDataPhase1
Lvl1MuSectorLogicDataPhase1()
Definition
Lvl1MuSectorLogicDataPhase1.cxx:14
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::pt
int pt(size_t id) const
Definition
Lvl1MuSectorLogicDataPhase1.h:52
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::bcid
int bcid() const
Definition
Lvl1MuSectorLogicDataPhase1.h:48
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::m_bcid
int m_bcid
Definition
Lvl1MuSectorLogicDataPhase1.h:96
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::getSystemId
int getSystemId() const
Definition
Lvl1MuSectorLogicDataPhase1.h:84
LVL1MUONIF
Namespace for the LVL1 muon interface classes.
Definition
Lvl1MuBarrelSectorLogicData.cxx:9
LVL1MUONIF::NBITS_CHARGE
static const unsigned int NBITS_CHARGE[3]
Definition
Lvl1MuSectorLogicConstantsPhase1.h:14
LVL1MUONIF::NBITS_ROI
static const unsigned int NBITS_ROI[3]
Definition
Lvl1MuSectorLogicConstantsPhase1.h:11
LVL1MUONIF::NBITS_BW2OR3
static const unsigned int NBITS_BW2OR3[3]
Definition
Lvl1MuSectorLogicConstantsPhase1.h:18
LVL1MUONIF::NBITS_IS2CANDIDATESINSECTOR
static const unsigned int NBITS_IS2CANDIDATESINSECTOR[3]
Definition
Lvl1MuSectorLogicConstantsPhase1.h:16
LVL1MUONIF::NBITS_GOODMF
static const unsigned int NBITS_GOODMF[3]
Definition
Lvl1MuSectorLogicConstantsPhase1.h:20
LVL1MUONIF::NBITS_PT
static const unsigned int NBITS_PT[3]
Definition
Lvl1MuSectorLogicConstantsPhase1.h:13
LVL1MUONIF::NCAND
static const size_t NCAND[3]
Definition
Lvl1MuSectorLogicConstantsPhase1.h:22
LVL1MUONIF::NBITS_NSWMON
static const unsigned int NBITS_NSWMON[3]
Definition
Lvl1MuSectorLogicConstantsPhase1.h:17
LVL1MUONIF::NBITS_BCID
static const unsigned int NBITS_BCID[3]
Definition
Lvl1MuSectorLogicConstantsPhase1.h:10
LVL1MUONIF::NBITS_INNERCOIN
static const unsigned int NBITS_INNERCOIN[3]
Definition
Lvl1MuSectorLogicConstantsPhase1.h:19
Generated on
for ATLAS Offline Software by
1.17.0