ATLAS Offline Software
Loading...
Searching...
No Matches
Lvl1MuBarrelSectorLogicData.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
3*/
4#include <iomanip>
5#include <iostream>
6
8
9namespace LVL1MUONIF {
10
16
18
19 if ( ( right.getSystemId() == m_id_system ) &&
20 ( this != &right ) ) {
21
22 m_bcid = right.bcid();
24 for ( size_t i = 0; i < 2; ++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 }
31 }
32
33 return *this;
34 }
35
37
38 unsigned int val = 0;
39 // Bit 0
40 if ( is2candidatesInSector() ) {
41 val = 1;
42 }
43 // Bit 1-7
44 if ( roi( 0 ) < 0 ) {
45 val |= 0x00FE;
46 } else {
47 val |= ( 0x00C0 | ( roi( 0 ) & 0x01F ) << 1 );
48 }
49 // Bit 8-9
50 if ( ovl( 0 ) < 0 ) {
51 val |= 0x0300;
52 } else {
53 val |= ( ovl( 0 ) & 0x0003 ) << 8;
54 }
55 // Bit 10-16
56 if ( roi( 1 ) < 0 ) {
57 val |= 0x01FC00;
58 } else {
59 val |= ( 0x018000 | ( roi( 1 ) & 0x001F ) << 10 );
60 }
61 // Bit 17-18
62 if ( ovl( 1 ) < 0 ) {
63 val |= 0x060000;
64 } else {
65 val |= ( ovl( 1 ) & 0x0003 ) << 17;
66 }
67 // bit 19-21
68 if ( pt( 0 ) < 0 ) {
69 val |= 0x0380000;
70 } else {
71 val |= ( pt( 0 ) & 0x0007 ) << 19;
72 }
73 // bit 22-24
74 if ( pt( 1 ) < 0 ) {
75 val |= 0x01C00000;
76 } else {
77 val |= ( pt( 1 ) & 0x0007 ) << 22;
78 }
79 // bit 25
80 if ( is2candidates( 0 ) ) {
81 val |= 0x02000000;
82 }
83 // bit 26
84 if ( is2candidates( 1 ) ) {
85 val |= 0x04000000;
86 }
87 // bit 27-29
88 val |= ( bcid() & 0x07 ) << 27;
89 // bit 30
90 if ( charge( 0 ) > 0 ) val |= 0x040000000;
91 // bit 31
92 if ( charge( 1 ) > 0 ) val |= 0x080000000;
93
94 return val;
95 }
96
97
99
100 unsigned int val;
101 // Bit 0
102 if ( value & 0x0001 ) {
104 } else {
106 }
107 // Bit 1-9
108 val = ( value >> 1 ) & 0x001F;
109 if ( val == 0x001F ) {
110 roi( 0, -1 );
111 ovl( 0, -1 );
112 } else {
113 roi( 0, val );
114 ovl( 0, ( value >> 8 ) & 0x0003 );
115 }
116 // Bit 10-18
117 val = ( value >> 10 ) & 0x001F;
118 if ( val == 0x001F ) {
119 roi( 1, -1 );
120 ovl( 1, -1 );
121 } else {
122 roi( 1, val );
123 ovl( 1, ( value >> 17 ) & 0x0003 );
124 }
125 // bit 19-21
126 val = ( value >> 19 ) & 0x0007;
127 if ( val == 0x0007 ) {
128 pt( 0, -1 );
129 } else {
130 pt( 0, val );
131 }
132 // bit 22-24
133 val = ( value >> 22 ) & 0x0007;
134 if ( val == 0x0007 ) {
135 pt( 1, -1 );
136 } else {
137 pt( 1, val );
138 }
139 // bit 25
140 val = ( value >> 25 ) & 0x0001;
141 if ( val ) {
142 set2candidates( 0 );
143 } else {
144 clear2candidates( 0 );
145 }
146 // bit 26
147 val = ( value >> 26 ) & 0x0001;
148 if ( val ) {
149 set2candidates( 1 );
150 } else {
151 clear2candidates( 1 );
152 }
153 // bit 27-29
154 val = ( value >> 27 ) & 0x0007;
155 bcid( val );
156 // bit 30
157 val = ( value >> 30 ) & 0x0001;
158 if ( val != 0 ) charge( 0, + 1 );
159 // bit 31
160 val = ( value >> 31 ) & 0x0001;
161 if ( val != 0 ) charge( 1, + 1 );
162
163 return *this;
164 }
165
166
167 void Lvl1MuBarrelSectorLogicData::printOut( std::ostream& out ) const {
168
169 out << "Bit 0 " << " >2candidates in a sector ";
170 out << std::setw( 8 ) << m_2candidatesInSector << std::endl;
171
172 out << "Bit 1-5 " << " ROI<1> ";
173 if ( m_roi[ 0 ] == -1 ) {
174 out << std::setw( 8 ) << "NA" << std::endl;
175 } else {
176 out << std::setw( 8 ) << m_roi[ 0 ] << std::endl;
177 }
178 out << "Bit 6-7 " << " NA " << std::endl;
179 out << "Bit 8-9 " << " OVL<1> ";
180 if ( m_ovl[ 0 ] == 0 ) {
181 out << std::setw( 8 ) << "No Ovl" << std::endl;
182 } else if ( m_ovl[ 0 ] == 1 ) {
183 out << std::setw( 8 ) << "Phi" << std::endl;
184 } else if ( m_ovl[ 0 ] == 2 ) {
185 out << std::setw( 8 ) << "Eta" << std::endl;
186 } else if ( m_ovl[ 0 ] == 3 ) {
187 out << std::setw( 8 ) << "Phi,Eta" << std::endl;
188 } else {
189 out << std::setw( 8 ) << "NA" << std::endl;
190 }
191 out << "Bit 10-14 " << " ROI<2> ";
192 if ( m_roi[ 1 ] == -1 ) {
193 out << std::setw( 8 ) << "NA" << std::endl;
194 } else {
195 out << std::setw( 8 ) << m_roi[ 1 ] << std::endl;
196 }
197 out << "Bit 15-16 " << " NA " << std::endl;
198 out << "Bit 17-18 " << " OVL<2> ";
199 if ( m_ovl[ 1 ] == 0 ) {
200 out << std::setw( 8 ) << "No Ovl" << std::endl;
201 } else if ( m_ovl[ 1 ] == 1 ) {
202 out << std::setw( 8 ) << "Phi" << std::endl;
203 } else if ( m_ovl[ 1 ] == 2 ) {
204 out << std::setw( 8 ) << "Eta" << std::endl;
205 } else if ( m_ovl[ 1 ] == 3 ) {
206 out << std::setw( 8 ) << "Phi,Eta" << std::endl;
207 } else {
208 out << std::setw( 8 ) << "NA" << std::endl;
209 }
210 out << "Bit 19-21 " << " Pt1 ";
211 if ( m_pt[ 0 ] == -1 ) {
212 out << std::setw( 8 ) << "No Hit" << std::endl;
213 } else {
214 out << std::setw( 8 ) << m_pt[ 0 ] << std::endl;
215 }
216 out << "Bit 22-24 " << " Pt2 ";
217 if ( m_pt[ 1 ] == -1 ) {
218 out << std::setw( 8 ) << "No Hit" << std::endl;
219 } else {
220 out << std::setw( 8 ) << m_pt[ 1 ] << std::endl;
221 }
222 out << "Bit 25 " << " >2candidates in ROI1 ";
223 out << std::setw( 8 ) << m_2candidates[ 0 ] << std::endl;
224 out << "Bit 26 " << " >2candidates in ROI2 ";
225 out << std::setw( 8 ) << m_2candidates[ 1 ] << std::endl;
226 out << "Bit 27-29 " << " BCID ";
227 out << std::setw( 8 ) << m_bcid << std::endl;
228 out << "Bit 30 " << " charge in ROI1 ";
229 out << std::setw( 8 ) << m_charge[ 0 ] << std::endl;
230 out << "Bit 31 " << " charge in ROI2 ";
231 out << std::setw( 8 ) << m_charge[ 1 ] << std::endl;
232
233 return;
234 }
235
236} // namespace LVL1MUONIF
SectorLogicWord getWordFormat() const
Get data in 32 bit word format.
virtual void printOut(std::ostream &out) const
print out data
Lvl1MuBarrelSectorLogicData & operator=(const Lvl1MuSectorLogicData &right)
const Lvl1MuSectorLogicData & convertFromWordFormat(const SectorLogicWord &)
Convert SectorLogicData from 32 bit word data.
Namespace for the LVL1 muon interface classes.