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