CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes | Friends
L1MuBMAddressArray Class Reference

#include <L1MuBMAddressArray.h>

Public Member Functions

L1MuBMAddressArray converted () const
 get converted Addresses More...
 
 L1MuBMAddressArray ()
 default constructor More...
 
 L1MuBMAddressArray (const L1MuBMAddressArray &)
 copy constructor More...
 
bool operator!= (const L1MuBMAddressArray &) const
 unequal operator More...
 
L1MuBMAddressArrayoperator= (const L1MuBMAddressArray &)
 assignment operator More...
 
bool operator== (const L1MuBMAddressArray &) const
 equal operator More...
 
void reset ()
 reset address array More...
 
void setStation (int stat, int adr)
 set address of a given station [1-4] More...
 
void setStations (int adr1, int adr2, int adr3, int adr4)
 set addresses of all four stations More...
 
unsigned short station (int stat) const
 get address of a given station [1-4] More...
 
int trackAddressCode () const
 get track address code (for eta track finder) More...
 
virtual ~L1MuBMAddressArray ()
 destructor More...
 

Static Public Member Functions

static unsigned short int convert (unsigned short int adr)
 convert address to corresponding VHDL addresse More...
 
static bool nextWheel (unsigned short int adr)
 is it a next wheel address? More...
 
static bool sameWheel (unsigned short int adr)
 is it a same wheel address? More...
 

Private Attributes

unsigned short int m_station [4]
 

Friends

std::ostream & operator<< (std::ostream &, const L1MuBMAddressArray &)
 output stream operator for address array More...
 

Detailed Description

Array of relative addresses

Array of 4 relative addresses (one per station);
the valid range of a relative address is 0 - 11 thus a relative address is a 4 bit word;
address = 15 indicates a negative extrapolation result

*         ------------------------
*         |   4    5  |   6   7  |
*      P  ------------+-----------
*      H  |   0    1  |   2   3  |
*      I  ------------+-----------
*         |   8    9  |  10  11  |
*         ------------+-----------
*            my Wheel  next Wheel
*   
N. Neumeister            CERN EP

Definition at line 50 of file L1MuBMAddressArray.h.

Constructor & Destructor Documentation

L1MuBMAddressArray::L1MuBMAddressArray ( )

default constructor

Definition at line 43 of file L1MuBMAddressArray.cc.

References reset().

43  {
44 
45  reset();
46 
47 }
void reset()
reset address array
L1MuBMAddressArray::L1MuBMAddressArray ( const L1MuBMAddressArray addarray)

copy constructor

Definition at line 50 of file L1MuBMAddressArray.cc.

References m_station.

50  {
51 
52  for ( int stat = 1; stat <= 4; stat++ ) {
53  m_station[stat-1] = addarray.m_station[stat-1];
54  }
55 
56 }
unsigned short int m_station[4]
L1MuBMAddressArray::~L1MuBMAddressArray ( )
virtual

destructor

Definition at line 63 of file L1MuBMAddressArray.cc.

63 {}

Member Function Documentation

unsigned short int L1MuBMAddressArray::convert ( unsigned short int  adr)
static

convert address to corresponding VHDL addresse

Definition at line 259 of file L1MuBMAddressArray.cc.

Referenced by converted(), and station().

259  {
260 
261  unsigned short int newaddress = 15;
262 
263  switch ( adr ) {
264  case 0 : { newaddress = 8; break; }
265  case 1 : { newaddress = 9; break; }
266  case 2 : { newaddress = 0; break; }
267  case 3 : { newaddress = 1; break; }
268  case 4 : { newaddress = 10; break; }
269  case 5 : { newaddress = 11; break; }
270  case 6 : { newaddress = 2; break; }
271  case 7 : { newaddress = 3; break; }
272  case 8 : { newaddress = 12; break; }
273  case 9 : { newaddress = 13; break; }
274  case 10 : { newaddress = 4; break; }
275  case 11 : { newaddress = 5; break; }
276  case 15 : { newaddress = 15; break; }
277  default: { newaddress = 15; break; }
278 
279  }
280 
281  return newaddress;
282 
283 }
L1MuBMAddressArray L1MuBMAddressArray::converted ( ) const

get converted Addresses

Definition at line 226 of file L1MuBMAddressArray.cc.

References convert(), and setStations().

Referenced by station().

226  {
227 
228  unsigned short int adr1 = L1MuBMAddressArray::convert(m_station[0]);
229  unsigned short int adr2 = L1MuBMAddressArray::convert(m_station[1]);
230  unsigned short int adr3 = L1MuBMAddressArray::convert(m_station[2]);
231  unsigned short int adr4 = L1MuBMAddressArray::convert(m_station[3]);
232 
233  L1MuBMAddressArray newaddressarray;
234  newaddressarray.setStations(adr1,adr2,adr3,adr4);
235 
236  return newaddressarray;
237 
238 }
static unsigned short int convert(unsigned short int adr)
convert address to corresponding VHDL addresse
void setStations(int adr1, int adr2, int adr3, int adr4)
set addresses of all four stations
unsigned short int m_station[4]
bool L1MuBMAddressArray::nextWheel ( unsigned short int  adr)
static

is it a next wheel address?

Definition at line 300 of file L1MuBMAddressArray.cc.

Referenced by station().

300  {
301 
302  // if ( adr > 15 ) cerr << "L1MuBMAddressArray : Error wrong address " << adr << endl;
303  return ( (adr/2)%2 == 1 );
304 
305 }
bool L1MuBMAddressArray::operator!= ( const L1MuBMAddressArray addarray) const

unequal operator

Definition at line 102 of file L1MuBMAddressArray.cc.

References m_station.

102  {
103 
104  for ( int stat = 1; stat <= 4; stat++ ) {
105  if ( m_station[stat-1] != addarray.m_station[stat-1] ) return true;
106  }
107 
108  return false;
109 
110 }
unsigned short int m_station[4]
L1MuBMAddressArray & L1MuBMAddressArray::operator= ( const L1MuBMAddressArray addarray)

assignment operator

Definition at line 73 of file L1MuBMAddressArray.cc.

References m_station.

73  {
74 
75  if ( this != &addarray ) {
76  for ( int stat = 1; stat <= 4; stat++ ) {
77  m_station[stat-1] = addarray.m_station[stat-1];
78  }
79  }
80  return *this;
81 
82 }
unsigned short int m_station[4]
bool L1MuBMAddressArray::operator== ( const L1MuBMAddressArray addarray) const

equal operator

Definition at line 88 of file L1MuBMAddressArray.cc.

References m_station.

88  {
89 
90  for ( int stat = 1; stat <= 4; stat++ ) {
91  if ( m_station[stat-1] != addarray.m_station[stat-1] ) return false;
92  }
93 
94  return true;
95 
96 }
unsigned short int m_station[4]
void L1MuBMAddressArray::reset ( void  )

reset address array

Definition at line 116 of file L1MuBMAddressArray.cc.

Referenced by L1MuBMTrackAssembler::reset(), L1MuBMAssignmentUnit::reset(), L1MuBMTrack::reset(), and L1MuBMTrackAssembler::run().

116  {
117 
118  for ( int stat = 1; stat <= 4; stat++ ) {
119  m_station[stat-1] = 15;
120  }
121 
122 }
unsigned short int m_station[4]
bool L1MuBMAddressArray::sameWheel ( unsigned short int  adr)
static

is it a same wheel address?

Definition at line 289 of file L1MuBMAddressArray.cc.

Referenced by station().

289  {
290 
291  // if ( adr > 15 ) cerr << "L1MuBMAddressArray : Error wrong address " << adr << endl;
292  return ( (adr/2)%2 == 0 );
293 
294 }
void L1MuBMAddressArray::setStation ( int  stat,
int  adr 
)

set address of a given station [1-4]

Definition at line 128 of file L1MuBMAddressArray.cc.

Referenced by L1MuBMTrackAssembler::run().

128  {
129 
130  // assert( stat > 0 && stat <= 4 );
131  // assert( adr >= 0 && adr <= 15 );
132  m_station[stat-1] = adr;
133 
134 }
unsigned short int m_station[4]
void L1MuBMAddressArray::setStations ( int  adr1,
int  adr2,
int  adr3,
int  adr4 
)

set addresses of all four stations

Definition at line 140 of file L1MuBMAddressArray.cc.

Referenced by converted(), L1MuBMTrackAssembler::runAddressAssignment1(), and L1MuBMTrackAssembler::runAddressAssignment2().

140  {
141 
142  setStation(1,adr1);
143  setStation(2,adr2);
144  setStation(3,adr3);
145  setStation(4,adr4);
146 
147 }
void setStation(int stat, int adr)
set address of a given station [1-4]
unsigned short L1MuBMAddressArray::station ( int  stat) const
inline
int L1MuBMAddressArray::trackAddressCode ( ) const

get track address code (for eta track finder)

Definition at line 153 of file L1MuBMAddressArray.cc.

References indexGen::s2.

Referenced by L1MuBMEtaProcessor::receiveAddresses(), and station().

153  {
154 
155  int code = -1;
156 
157  int s1 = m_station[0];
158  s1 = ( s1 == 15 ) ? 0 : ((s1/2)%2)+1;
159  int s2 = m_station[1];
160  s2 = ( s2 == 15 ) ? 0 : ((s2/2)%2)+1;
161  int s3 = m_station[2];
162  s3 = ( s3 == 15 ) ? 0 : ((s3/2)%2)+1;
163  int s4 = m_station[3];
164  s4 = ( s4 == 15 ) ? 0 : ((s4/2)%2)+1;
165 
166  // 0 ... empty track segment
167  // 1 ... same wheel
168  // 2 ... next wheel
169 
170  if ( s1 == 0 && s2 == 0 && s3 == 0 && s4 == 0 ) code = 0;
171  if ( s1 == 0 && s2 == 0 && s3 == 2 && s4 == 1 ) code = 0;
172  if ( s1 == 0 && s2 == 0 && s3 == 2 && s4 == 2 ) code = 0;
173  if ( s1 == 0 && s2 == 2 && s3 == 0 && s4 == 1 ) code = 0;
174  if ( s1 == 0 && s2 == 2 && s3 == 0 && s4 == 2 ) code = 0;
175  if ( s1 == 0 && s2 == 2 && s3 == 1 && s4 == 0 ) code = 0;
176  if ( s1 == 0 && s2 == 2 && s3 == 2 && s4 == 0 ) code = 0;
177  if ( s1 == 0 && s2 == 1 && s3 == 2 && s4 == 1 ) code = 0;
178  if ( s1 == 0 && s2 == 2 && s3 == 1 && s4 == 1 ) code = 0;
179  if ( s1 == 0 && s2 == 2 && s3 == 1 && s4 == 2 ) code = 0;
180  if ( s1 == 0 && s2 == 2 && s3 == 2 && s4 == 1 ) code = 0;
181  if ( s1 == 0 && s2 == 2 && s3 == 2 && s4 == 2 ) code = 0;
182  if ( s1 == 1 && s2 == 0 && s3 == 2 && s4 == 1 ) code = 0;
183  if ( s1 == 1 && s2 == 2 && s3 == 0 && s4 == 1 ) code = 0;
184  if ( s1 == 1 && s2 == 2 && s3 == 1 && s4 == 0 ) code = 0;
185  if ( s1 == 1 && s2 == 1 && s3 == 2 && s4 == 1 ) code = 0;
186  if ( s1 == 1 && s2 == 2 && s3 == 1 && s4 == 1 ) code = 0;
187  if ( s1 == 1 && s2 == 2 && s3 == 1 && s4 == 2 ) code = 0;
188  if ( s1 == 1 && s2 == 2 && s3 == 2 && s4 == 1 ) code = 0;
189  if ( s1 == 0 && s2 == 0 && s3 == 1 && s4 == 1 ) code = 1;
190  if ( s1 == 0 && s2 == 0 && s3 == 1 && s4 == 2 ) code = 2;
191  if ( s1 == 0 && s2 == 1 && s3 == 0 && s4 == 1 ) code = 3;
192  if ( s1 == 0 && s2 == 1 && s3 == 0 && s4 == 2 ) code = 4;
193  if ( s1 == 0 && s2 == 1 && s3 == 1 && s4 == 0 ) code = 5;
194  if ( s1 == 0 && s2 == 1 && s3 == 1 && s4 == 1 ) code = 6;
195  if ( s1 == 0 && s2 == 1 && s3 == 1 && s4 == 2 ) code = 7;
196  if ( s1 == 0 && s2 == 1 && s3 == 2 && s4 == 0 ) code = 8;
197  if ( s1 == 0 && s2 == 1 && s3 == 2 && s4 == 2 ) code = 8;
198  if ( s1 == 1 && s2 == 0 && s3 == 0 && s4 == 1 ) code = 9;
199  if ( s1 == 1 && s2 == 0 && s3 == 0 && s4 == 2 ) code = 10;
200  if ( s1 == 1 && s2 == 0 && s3 == 1 && s4 == 0 ) code = 11;
201  if ( s1 == 1 && s2 == 0 && s3 == 1 && s4 == 1 ) code = 12;
202  if ( s1 == 1 && s2 == 0 && s3 == 1 && s4 == 2 ) code = 13;
203  if ( s1 == 1 && s2 == 0 && s3 == 2 && s4 == 0 ) code = 14;
204  if ( s1 == 1 && s2 == 0 && s3 == 2 && s4 == 2 ) code = 14;
205  if ( s1 == 1 && s2 == 1 && s3 == 0 && s4 == 0 ) code = 15;
206  if ( s1 == 1 && s2 == 1 && s3 == 0 && s4 == 1 ) code = 16;
207  if ( s1 == 1 && s2 == 1 && s3 == 0 && s4 == 2 ) code = 17;
208  if ( s1 == 1 && s2 == 1 && s3 == 1 && s4 == 0 ) code = 18;
209  if ( s1 == 1 && s2 == 1 && s3 == 1 && s4 == 1 ) code = 19;
210  if ( s1 == 1 && s2 == 1 && s3 == 1 && s4 == 2 ) code = 20;
211  if ( s1 == 1 && s2 == 1 && s3 == 2 && s4 == 0 ) code = 21;
212  if ( s1 == 1 && s2 == 1 && s3 == 2 && s4 == 2 ) code = 21;
213  if ( s1 == 1 && s2 == 2 && s3 == 0 && s4 == 0 ) code = 22;
214  if ( s1 == 1 && s2 == 2 && s3 == 0 && s4 == 2 ) code = 22;
215  if ( s1 == 1 && s2 == 2 && s3 == 2 && s4 == 0 ) code = 22;
216  if ( s1 == 1 && s2 == 2 && s3 == 2 && s4 == 2 ) code = 22;
217 
218  return code;
219 
220 }
unsigned short int m_station[4]

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  ,
const L1MuBMAddressArray  
)
friend

output stream operator for address array

Referenced by station().

Member Data Documentation

unsigned short int L1MuBMAddressArray::m_station[4]
private

Definition at line 104 of file L1MuBMAddressArray.h.

Referenced by L1MuBMAddressArray(), operator!=(), operator=(), operator==(), and station().