ATLAS Offline Software
Loading...
Searching...
No Matches
Lvl1MuEndcapSectorLogicData.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 <iomanip>
6#include <iostream>
7
9
10namespace LVL1MUONIF {
11
16
18 if ( ( right.getSystemId() == m_id_system ) &&
19 ( this != &right ) ) {
20 m_bcid = right.bcid();
22 for ( size_t i = 0; i < 2; ++i ) {
23 m_roi[ i ] = right.roi( i );
24 m_ovl[ i ] = right.ovl( i );
25 m_pt[ i ] = right.pt( i );
26 m_charge[ i ] = right.charge( i );
27 m_2candidates[ i ] = right.is2candidates( i );
28 }
29 }
30 return *this;
31 }
32
34
35 unsigned int val = 0;
36 // Bit 0
37 if ( is2candidatesInSector() ) {
38 val = 1;
39 }
40 // Bit 1-8
41 if ( roi( 0 ) < 0 ) {
42 val |= 0x01FE;
43 } else {
44 val |= ( roi( 0 ) & 0x0FF ) << 1;
45 }
46 // Bit 9
47 if ( ovl( 0 ) < 0 ) {
48 val |= 0x0200;
49 } else {
50 val |= ( ovl( 0 ) & 0x0001 ) << 9;
51 }
52 // Bit 10-17
53 if ( roi( 1 ) < 0 ) {
54 val |= 0x03FC00;
55 } else {
56 val |= ( roi( 1 ) & 0x00FF ) << 10;
57 }
58 // Bit 18
59 if ( ovl( 1 ) < 0 ) {
60 val |= 0x040000;
61 } else {
62 val |= ( ovl( 1 ) & 0x0001 ) << 18;
63 }
64 // bit 19-21
65 if ( pt( 0 ) < 0 ) {
66 val |= 0x0380000;
67 } else {
68 val |= ( pt( 0 ) & 0x0007 ) << 19;
69 }
70 // bit 22-24
71 if ( pt( 1 ) < 0 ) {
72 val |= 0x01C00000;
73 } else {
74 val |= ( pt( 1 ) & 0x0007 ) << 22;
75 }
76 // bit 25
77 val |= 0x02000000;
78 // bit 26
79 val |= 0x04000000;
80 // bit 27-29
81 val |= ( bcid() & 0x07 ) << 27;
82 // bit 30
83 if ( charge( 0 ) > 0 ) val |= 0x040000000;
84 // bit 31
85 if ( charge( 1 ) > 0 ) val |= 0x080000000;
86
87 return val;
88 }
89
90
92
93 unsigned int val;
94 // Bit 0
95 if ( value & 0x0001 ) {
97 } else {
99 }
100 // Bit 1-9
101 val = ( value >> 1 ) & 0x00FF;
102 if ( val == 0x00FF ) {
103 roi( 0, -1 );
104 ovl( 0, -1 );
105 } else {
106 roi( 0, val );
107 ovl( 0, ( value >> 9 ) & 0x0001 );
108 }
109 // Bit 10-18
110 val = ( value >> 10 ) & 0x00FF;
111 if ( val == 0x00FF ) {
112 roi( 1, -1 );
113 ovl( 1, -1 );
114 } else {
115 roi( 1, val );
116 ovl( 1, ( value >> 18 ) & 0x0001 );
117 }
118 // bit 19-21
119 val = ( value >> 19 ) & 0x0007;
120 if ( val == 0x0007 ) {
121 pt( 0, -1 );
122 } else {
123 pt( 0, val );
124 }
125 // bit 22-24
126 val = ( value >> 22 ) & 0x0007;
127 if ( val == 0x0007 ) {
128 pt( 1, -1 );
129 } else {
130 pt( 1, val );
131 }
132 // bit 25
133 clear2candidates( 0 );
134 // bit 26
135 clear2candidates( 1 );
136 // bit 27-29
137 val = ( value >> 27 ) & 0x0007;
138 bcid( val );
139 // bit 30
140 val = ( value >> 30 ) & 0x0001;
141 if ( val != 0 ) charge( 0, + 1 );
142 // bit 31
143 val = ( value >> 31 ) & 0x0001;
144 if ( val != 0 ) charge( 1, + 1 );
145
146 return *this;
147 }
148
149
150 void Lvl1MuEndcapSectorLogicData::printOut( std::ostream& out ) const {
151
152 out << "Bit 0 " << " >2candidates in a sector ";
153 out << std::setw( 8 ) << m_2candidatesInSector << std::endl;
154
155 out << "Bit 1-8 " << " ROI<1> ";
156 if ( m_roi[ 0 ] == -1 ) {
157 out << std::setw( 8 ) << "NA" << std::endl;
158 } else {
159 out << std::setw( 8 ) << m_roi[ 0 ] << std::endl;
160 }
161 out << "Bit 9 " << " OVL<1> ";
162 if ( m_ovl[ 0 ] < 0 ) {
163 out << std::setw( 8 ) << "NA" << std::endl;
164 } else {
165 out << std::setw( 8 ) << m_ovl[ 0 ] << std::endl;
166 }
167 out << "Bit 10-17 " << " ROI<2> ";
168 if ( m_roi[ 1 ] == -1 ) {
169 out << std::setw( 8 ) << "NA" << std::endl;
170 } else {
171 out << std::setw( 8 ) << m_roi[ 1 ] << std::endl;
172 }
173 out << "Bit 18 " << " OVL<2> ";
174 if ( m_ovl[ 1 ] < 0 ) {
175 out << std::setw( 8 ) << "NA" << std::endl;
176 } else {
177 out << std::setw( 8 ) << m_ovl[ 1 ] << std::endl;
178 }
179 out << "Bit 19-21 " << " Pt1 ";
180 if ( m_pt[ 0 ] == -1 ) {
181 out << std::setw( 8 ) << "No Hit" << std::endl;
182 } else {
183 out << std::setw( 8 ) << m_pt[ 0 ] << std::endl;
184 }
185 out << "Bit 22-24 " << " Pt2 ";
186 if ( m_pt[ 1 ] == -1 ) {
187 out << std::setw( 8 ) << "No Hit" << std::endl;
188 } else {
189 out << std::setw( 8 ) << m_pt[ 1 ] << std::endl;
190 }
191 out << "Bit 25-26 " << " NA " << std::endl;
192 out << "Bit 27-29 " << " BCID ";
193 out << std::setw( 8 ) << m_bcid << std::endl;
194 out << "Bit 30 " << " charge in ROI1 ";
195 out << std::setw( 8 ) << m_charge[ 0 ] << std::endl;
196 out << "Bit 31 " << " charge in ROI2 ";
197 out << std::setw( 8 ) << m_charge[ 1 ] << std::endl;
198 }
199
200} // namespace LVL1MUONIF
SectorLogicWord getWordFormat() const
Get data in 32 bit word format.
Lvl1MuEndcapSectorLogicData & operator=(const Lvl1MuSectorLogicData &right)
const Lvl1MuSectorLogicData & convertFromWordFormat(const SectorLogicWord &)
Convert SectorLogicData from 32 bit word data.
virtual void printOut(std::ostream &out) const
print out data
Namespace for the LVL1 muon interface classes.