CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Attributes | Friends
L1MuDTAddressArray Class Reference

#include <L1MuDTAddressArray.h>

Public Member Functions

L1MuDTAddressArray converted () const
 get converted Addresses More...
 
 L1MuDTAddressArray ()
 default constructor More...
 
 L1MuDTAddressArray (const L1MuDTAddressArray &)
 copy constructor More...
 
bool operator!= (const L1MuDTAddressArray &) const
 unequal operator More...
 
L1MuDTAddressArrayoperator= (const L1MuDTAddressArray &)
 assignment operator More...
 
bool operator== (const L1MuDTAddressArray &) 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 ~L1MuDTAddressArray ()
 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 L1MuDTAddressArray &)
 output stream operator for address array More...
 

Detailed Description

Array of relative addresses

Array of 4 relative addresses (one per station);<BR>
the valid range of a relative address is 0 - 11
thus a relative address is a 4 bit word;<BR>
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
*   
$Date: 2007/02/27 11:44:00 $
$Revision: 1.2 $

N. Neumeister            CERN EP

Definition at line 52 of file L1MuDTAddressArray.h.

Constructor & Destructor Documentation

L1MuDTAddressArray::L1MuDTAddressArray ( )

default constructor

Definition at line 45 of file L1MuDTAddressArray.cc.

References reset().

45  {
46 
47  reset();
48 
49 }
void reset()
reset address array
L1MuDTAddressArray::L1MuDTAddressArray ( const L1MuDTAddressArray addarray)

copy constructor

Definition at line 52 of file L1MuDTAddressArray.cc.

References m_station.

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

destructor

Definition at line 65 of file L1MuDTAddressArray.cc.

65 {}

Member Function Documentation

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

convert address to corresponding VHDL addresse

Definition at line 261 of file L1MuDTAddressArray.cc.

Referenced by converted().

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

get converted Addresses

Definition at line 228 of file L1MuDTAddressArray.cc.

References convert(), and setStations().

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

is it a next wheel address?

Definition at line 302 of file L1MuDTAddressArray.cc.

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

unequal operator

Definition at line 104 of file L1MuDTAddressArray.cc.

References m_station.

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

assignment operator

Definition at line 75 of file L1MuDTAddressArray.cc.

References m_station.

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

equal operator

Definition at line 90 of file L1MuDTAddressArray.cc.

References m_station.

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

reset address array

Definition at line 118 of file L1MuDTAddressArray.cc.

Referenced by L1MuDTTrackAssembler::reset(), L1MuDTAssignmentUnit::reset(), L1MuDTTrack::reset(), and L1MuDTTrackAssembler::run().

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

is it a same wheel address?

Definition at line 291 of file L1MuDTAddressArray.cc.

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

set address of a given station [1-4]

Definition at line 130 of file L1MuDTAddressArray.cc.

Referenced by L1MuDTTrackAssembler::run().

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

set addresses of all four stations

Definition at line 142 of file L1MuDTAddressArray.cc.

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

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

get track address code (for eta track finder)

Definition at line 155 of file L1MuDTAddressArray.cc.

References indexGen::s2.

Referenced by L1MuDTEtaProcessor::receiveAddresses().

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

Friends And Related Function Documentation

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

output stream operator for address array

Member Data Documentation

unsigned short int L1MuDTAddressArray::m_station[4]
private

Definition at line 106 of file L1MuDTAddressArray.h.

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