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