CMS 3D CMS Logo

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);
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 L1MuDTAddressArray.h.

Constructor & Destructor Documentation

◆ L1MuDTAddressArray() [1/2]

L1MuDTAddressArray::L1MuDTAddressArray ( )

default constructor

Definition at line 43 of file L1MuDTAddressArray.cc.

43 { reset(); }

References reset().

◆ L1MuDTAddressArray() [2/2]

L1MuDTAddressArray::L1MuDTAddressArray ( const L1MuDTAddressArray addarray)

copy constructor

Definition at line 45 of file L1MuDTAddressArray.cc.

45  {
46  for (int stat = 1; stat <= 4; stat++) {
47  m_station[stat - 1] = addarray.m_station[stat - 1];
48  }
49 }

References m_station, and hgcalPlots::stat.

◆ ~L1MuDTAddressArray()

L1MuDTAddressArray::~L1MuDTAddressArray ( )
virtual

destructor

Definition at line 55 of file L1MuDTAddressArray.cc.

55 {}

Member Function Documentation

◆ convert()

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

convert address to corresponding VHDL addresse

Definition at line 272 of file L1MuDTAddressArray.cc.

272  {
273  unsigned short int newaddress = 15;
274 
275  switch (adr) {
276  case 0: {
277  newaddress = 8;
278  break;
279  }
280  case 1: {
281  newaddress = 9;
282  break;
283  }
284  case 2: {
285  newaddress = 0;
286  break;
287  }
288  case 3: {
289  newaddress = 1;
290  break;
291  }
292  case 4: {
293  newaddress = 10;
294  break;
295  }
296  case 5: {
297  newaddress = 11;
298  break;
299  }
300  case 6: {
301  newaddress = 2;
302  break;
303  }
304  case 7: {
305  newaddress = 3;
306  break;
307  }
308  case 8: {
309  newaddress = 12;
310  break;
311  }
312  case 9: {
313  newaddress = 13;
314  break;
315  }
316  case 10: {
317  newaddress = 4;
318  break;
319  }
320  case 11: {
321  newaddress = 5;
322  break;
323  }
324  case 15: {
325  newaddress = 15;
326  break;
327  }
328  default: {
329  newaddress = 15;
330  break;
331  }
332  }
333 
334  return newaddress;
335 }

Referenced by converted().

◆ converted()

L1MuDTAddressArray L1MuDTAddressArray::converted ( ) const

get converted Addresses

Definition at line 245 of file L1MuDTAddressArray.cc.

245  {
246  unsigned short int adr1 = L1MuDTAddressArray::convert(m_station[0]);
247  unsigned short int adr2 = L1MuDTAddressArray::convert(m_station[1]);
248  unsigned short int adr3 = L1MuDTAddressArray::convert(m_station[2]);
249  unsigned short int adr4 = L1MuDTAddressArray::convert(m_station[3]);
250 
251  L1MuDTAddressArray newaddressarray;
252  newaddressarray.setStations(adr1, adr2, adr3, adr4);
253 
254  return newaddressarray;
255 }

References convert(), and setStations().

◆ nextWheel()

bool L1MuDTAddressArray::nextWheel ( unsigned short int  adr)
static

is it a next wheel address?

Definition at line 348 of file L1MuDTAddressArray.cc.

348  {
349  // if ( adr > 15 ) cerr << "L1MuDTAddressArray : Error wrong address " << adr << endl;
350  return ((adr / 2) % 2 == 1);
351 }

◆ operator!=()

bool L1MuDTAddressArray::operator!= ( const L1MuDTAddressArray addarray) const

unequal operator

Definition at line 88 of file L1MuDTAddressArray.cc.

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

References m_station, and hgcalPlots::stat.

◆ operator=()

L1MuDTAddressArray & L1MuDTAddressArray::operator= ( const L1MuDTAddressArray addarray)

assignment operator

Definition at line 64 of file L1MuDTAddressArray.cc.

64  {
65  if (this != &addarray) {
66  for (int stat = 1; stat <= 4; stat++) {
67  m_station[stat - 1] = addarray.m_station[stat - 1];
68  }
69  }
70  return *this;
71 }

References m_station, and hgcalPlots::stat.

◆ operator==()

bool L1MuDTAddressArray::operator== ( const L1MuDTAddressArray addarray) const

equal operator

Definition at line 76 of file L1MuDTAddressArray.cc.

76  {
77  for (int stat = 1; stat <= 4; stat++) {
78  if (m_station[stat - 1] != addarray.m_station[stat - 1])
79  return false;
80  }
81 
82  return true;
83 }

References m_station, and hgcalPlots::stat.

◆ reset()

void L1MuDTAddressArray::reset ( void  )

reset address array

Definition at line 100 of file L1MuDTAddressArray.cc.

100  {
101  for (int stat = 1; stat <= 4; stat++) {
102  m_station[stat - 1] = 15;
103  }
104 }

References hgcalPlots::stat.

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

◆ sameWheel()

bool L1MuDTAddressArray::sameWheel ( unsigned short int  adr)
static

is it a same wheel address?

Definition at line 340 of file L1MuDTAddressArray.cc.

340  {
341  // if ( adr > 15 ) cerr << "L1MuDTAddressArray : Error wrong address " << adr << endl;
342  return ((adr / 2) % 2 == 0);
343 }

◆ setStation()

void L1MuDTAddressArray::setStation ( int  stat,
int  adr 
)

set address of a given station [1-4]

Definition at line 109 of file L1MuDTAddressArray.cc.

109  {
110  // assert( stat > 0 && stat <= 4 );
111  // assert( adr >= 0 && adr <= 15 );
112  m_station[stat - 1] = adr;
113 }

References hgcalPlots::stat.

Referenced by L1MuDTTrackAssembler::run().

◆ setStations()

void L1MuDTAddressArray::setStations ( int  adr1,
int  adr2,
int  adr3,
int  adr4 
)

set addresses of all four stations

Definition at line 118 of file L1MuDTAddressArray.cc.

118  {
119  setStation(1, adr1);
120  setStation(2, adr2);
121  setStation(3, adr3);
122  setStation(4, adr4);
123 }

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

◆ station()

unsigned short L1MuDTAddressArray::station ( int  stat) const
inline

◆ trackAddressCode()

int L1MuDTAddressArray::trackAddressCode ( ) const

get track address code (for eta track finder)

Definition at line 128 of file L1MuDTAddressArray.cc.

128  {
129  int code = -1;
130 
131  int s1 = m_station[0];
132  s1 = (s1 == 15) ? 0 : ((s1 / 2) % 2) + 1;
133  int s2 = m_station[1];
134  s2 = (s2 == 15) ? 0 : ((s2 / 2) % 2) + 1;
135  int s3 = m_station[2];
136  s3 = (s3 == 15) ? 0 : ((s3 / 2) % 2) + 1;
137  int s4 = m_station[3];
138  s4 = (s4 == 15) ? 0 : ((s4 / 2) % 2) + 1;
139 
140  // 0 ... empty track segment
141  // 1 ... same wheel
142  // 2 ... next wheel
143 
144  if (s1 == 0 && s2 == 0 && s3 == 0 && s4 == 0)
145  code = 0;
146  if (s1 == 0 && s2 == 0 && s3 == 2 && s4 == 1)
147  code = 0;
148  if (s1 == 0 && s2 == 0 && s3 == 2 && s4 == 2)
149  code = 0;
150  if (s1 == 0 && s2 == 2 && s3 == 0 && s4 == 1)
151  code = 0;
152  if (s1 == 0 && s2 == 2 && s3 == 0 && s4 == 2)
153  code = 0;
154  if (s1 == 0 && s2 == 2 && s3 == 1 && s4 == 0)
155  code = 0;
156  if (s1 == 0 && s2 == 2 && s3 == 2 && s4 == 0)
157  code = 0;
158  if (s1 == 0 && s2 == 1 && s3 == 2 && s4 == 1)
159  code = 0;
160  if (s1 == 0 && s2 == 2 && s3 == 1 && s4 == 1)
161  code = 0;
162  if (s1 == 0 && s2 == 2 && s3 == 1 && s4 == 2)
163  code = 0;
164  if (s1 == 0 && s2 == 2 && s3 == 2 && s4 == 1)
165  code = 0;
166  if (s1 == 0 && s2 == 2 && s3 == 2 && s4 == 2)
167  code = 0;
168  if (s1 == 1 && s2 == 0 && s3 == 2 && s4 == 1)
169  code = 0;
170  if (s1 == 1 && s2 == 2 && s3 == 0 && s4 == 1)
171  code = 0;
172  if (s1 == 1 && s2 == 2 && s3 == 1 && s4 == 0)
173  code = 0;
174  if (s1 == 1 && s2 == 1 && s3 == 2 && s4 == 1)
175  code = 0;
176  if (s1 == 1 && s2 == 2 && s3 == 1 && s4 == 1)
177  code = 0;
178  if (s1 == 1 && s2 == 2 && s3 == 1 && s4 == 2)
179  code = 0;
180  if (s1 == 1 && s2 == 2 && s3 == 2 && s4 == 1)
181  code = 0;
182  if (s1 == 0 && s2 == 0 && s3 == 1 && s4 == 1)
183  code = 1;
184  if (s1 == 0 && s2 == 0 && s3 == 1 && s4 == 2)
185  code = 2;
186  if (s1 == 0 && s2 == 1 && s3 == 0 && s4 == 1)
187  code = 3;
188  if (s1 == 0 && s2 == 1 && s3 == 0 && s4 == 2)
189  code = 4;
190  if (s1 == 0 && s2 == 1 && s3 == 1 && s4 == 0)
191  code = 5;
192  if (s1 == 0 && s2 == 1 && s3 == 1 && s4 == 1)
193  code = 6;
194  if (s1 == 0 && s2 == 1 && s3 == 1 && s4 == 2)
195  code = 7;
196  if (s1 == 0 && s2 == 1 && s3 == 2 && s4 == 0)
197  code = 8;
198  if (s1 == 0 && s2 == 1 && s3 == 2 && s4 == 2)
199  code = 8;
200  if (s1 == 1 && s2 == 0 && s3 == 0 && s4 == 1)
201  code = 9;
202  if (s1 == 1 && s2 == 0 && s3 == 0 && s4 == 2)
203  code = 10;
204  if (s1 == 1 && s2 == 0 && s3 == 1 && s4 == 0)
205  code = 11;
206  if (s1 == 1 && s2 == 0 && s3 == 1 && s4 == 1)
207  code = 12;
208  if (s1 == 1 && s2 == 0 && s3 == 1 && s4 == 2)
209  code = 13;
210  if (s1 == 1 && s2 == 0 && s3 == 2 && s4 == 0)
211  code = 14;
212  if (s1 == 1 && s2 == 0 && s3 == 2 && s4 == 2)
213  code = 14;
214  if (s1 == 1 && s2 == 1 && s3 == 0 && s4 == 0)
215  code = 15;
216  if (s1 == 1 && s2 == 1 && s3 == 0 && s4 == 1)
217  code = 16;
218  if (s1 == 1 && s2 == 1 && s3 == 0 && s4 == 2)
219  code = 17;
220  if (s1 == 1 && s2 == 1 && s3 == 1 && s4 == 0)
221  code = 18;
222  if (s1 == 1 && s2 == 1 && s3 == 1 && s4 == 1)
223  code = 19;
224  if (s1 == 1 && s2 == 1 && s3 == 1 && s4 == 2)
225  code = 20;
226  if (s1 == 1 && s2 == 1 && s3 == 2 && s4 == 0)
227  code = 21;
228  if (s1 == 1 && s2 == 1 && s3 == 2 && s4 == 2)
229  code = 21;
230  if (s1 == 1 && s2 == 2 && s3 == 0 && s4 == 0)
231  code = 22;
232  if (s1 == 1 && s2 == 2 && s3 == 0 && s4 == 2)
233  code = 22;
234  if (s1 == 1 && s2 == 2 && s3 == 2 && s4 == 0)
235  code = 22;
236  if (s1 == 1 && s2 == 2 && s3 == 2 && s4 == 2)
237  code = 22;
238 
239  return code;
240 }

References indexGen::s2.

Friends And Related Function Documentation

◆ operator<<

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

output stream operator for address array

Member Data Documentation

◆ m_station

unsigned short int L1MuDTAddressArray::m_station[4]
private

Definition at line 101 of file L1MuDTAddressArray.h.

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

L1MuDTAddressArray
Definition: L1MuDTAddressArray.h:50
L1MuDTAddressArray::convert
static unsigned short int convert(unsigned short int adr)
convert address to corresponding VHDL addresse
Definition: L1MuDTAddressArray.cc:272
indexGen.s2
s2
Definition: indexGen.py:107
hgcalPlots.stat
stat
Definition: hgcalPlots.py:1111
L1MuDTAddressArray::reset
void reset()
reset address array
Definition: L1MuDTAddressArray.cc:100
L1MuDTAddressArray::setStations
void setStations(int adr1, int adr2, int adr3, int adr4)
set addresses of all four stations
Definition: L1MuDTAddressArray.cc:118
L1MuDTAddressArray::m_station
unsigned short int m_station[4]
Definition: L1MuDTAddressArray.h:101
L1MuDTAddressArray::setStation
void setStation(int stat, int adr)
set address of a given station [1-4]
Definition: L1MuDTAddressArray.cc:109