CMS 3D CMS Logo

Public Member Functions | Static Public Member Functions | Private Attributes | Friends

L1MuDTAddressArray Class Reference

#include <L1MuDTAddressArray.h>

List of all members.

Public Member Functions

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

Static Public Member Functions

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

Private Attributes

unsigned short int m_station [4]

Friends

std::ostream & operator<< (std::ostream &, const L1MuDTAddressArray &)
 output stream operator for address array

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
 *   
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().

                                       {

  reset();

}
L1MuDTAddressArray::L1MuDTAddressArray ( const L1MuDTAddressArray addarray)

copy constructor

Definition at line 52 of file L1MuDTAddressArray.cc.

References m_station.

                                                                         {
  
  for ( int stat = 1; stat <= 4; stat++ ) {
    m_station[stat-1] = addarray.m_station[stat-1];
  }

}
L1MuDTAddressArray::~L1MuDTAddressArray ( ) [virtual]

destructor

Definition at line 65 of file L1MuDTAddressArray.cc.

{}

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.

                                                                     {

  unsigned short int newaddress = 15;

  switch ( adr ) {
    case  0 : { newaddress =  8; break; }
    case  1 : { newaddress =  9; break; }
    case  2 : { newaddress =  0; break; }
    case  3 : { newaddress =  1; break; }
    case  4 : { newaddress = 10; break; }
    case  5 : { newaddress = 11; break; }
    case  6 : { newaddress =  2; break; }
    case  7 : { newaddress =  3; break; }
    case  8 : { newaddress = 12; break; }
    case  9 : { newaddress = 13; break; }
    case 10 : { newaddress =  4; break; }
    case 11 : { newaddress =  5; break; }
    case 15 : { newaddress = 15; break; }
    default:  { newaddress = 15; break; }

  }

   return newaddress;

}
L1MuDTAddressArray L1MuDTAddressArray::converted ( ) const

get converted Addresses

Definition at line 228 of file L1MuDTAddressArray.cc.

References lhef::cc::convert(), and setStations().

                                                       {

  unsigned short int adr1 = L1MuDTAddressArray::convert(m_station[0]); 
  unsigned short int adr2 = L1MuDTAddressArray::convert(m_station[1]);
  unsigned short int adr3 = L1MuDTAddressArray::convert(m_station[2]);
  unsigned short int adr4 = L1MuDTAddressArray::convert(m_station[3]);

  L1MuDTAddressArray newaddressarray; 
  newaddressarray.setStations(adr1,adr2,adr3,adr4);

  return newaddressarray;

}
bool L1MuDTAddressArray::nextWheel ( unsigned short int  adr) [static]

is it a next wheel address?

Definition at line 302 of file L1MuDTAddressArray.cc.

                                                         {

  //  if ( adr > 15 ) cerr << "L1MuDTAddressArray : Error wrong address " << adr << endl;
  return ( (adr/2)%2 == 1 );

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

unequal operator

Definition at line 104 of file L1MuDTAddressArray.cc.

References m_station.

                                                                            {

  for ( int stat = 1; stat <= 4; stat++ ) {
    if ( m_station[stat-1] != addarray.m_station[stat-1] ) return true;
  }

  return false;

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

assignment operator

Definition at line 75 of file L1MuDTAddressArray.cc.

References m_station.

                                                                                    {

  if ( this != &addarray ) {
    for ( int stat = 1; stat <= 4; stat++ ) {
      m_station[stat-1] = addarray.m_station[stat-1];
    }
  }
  return *this;

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

equal operator

Definition at line 90 of file L1MuDTAddressArray.cc.

References m_station.

                                                                            {

  for ( int stat = 1; stat <= 4; stat++ ) {
    if ( m_station[stat-1] != addarray.m_station[stat-1] ) return false;
  }

  return true;

}
void L1MuDTAddressArray::reset ( void  )

reset address array

Definition at line 118 of file L1MuDTAddressArray.cc.

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

                               {

  for ( int stat = 1; stat <= 4; stat++ ) {
    m_station[stat-1] = 15; 
  }

}
bool L1MuDTAddressArray::sameWheel ( unsigned short int  adr) [static]

is it a same wheel address?

Definition at line 291 of file L1MuDTAddressArray.cc.

                                                         {

  //  if ( adr > 15 ) cerr << "L1MuDTAddressArray : Error wrong address " << adr << endl;
  return ( (adr/2)%2 == 0 );

}
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().

                                                     {

  //  assert( stat >  0 && stat <= 4 );
  //  assert( adr  >= 0 && adr  <= 15       );  
  m_station[stat-1] = adr;

}
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().

                                                                           {

  setStation(1,adr1);
  setStation(2,adr2);
  setStation(3,adr3);
  setStation(4,adr4);

}
unsigned short L1MuDTAddressArray::station ( int  stat) const [inline]

get address of a given station [1-4]

Definition at line 84 of file L1MuDTAddressArray.h.

References m_station.

Referenced by L1MuDTTrack::address(), L1MuDTTrackAssembler::address(), L1MuDTAssignmentUnit::getPtMethod(), operator<<(), L1MuDTTrackAssembler::run(), and L1MuDTAssignmentUnit::TSR().

{ return m_station[stat-1]; } 
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().

                                               {

  int code = -1;
  
  int s1 = m_station[0];
  s1 = ( s1 == 15 ) ? 0 : ((s1/2)%2)+1;
  int s2 = m_station[1];
  s2 = ( s2 == 15 ) ? 0 : ((s2/2)%2)+1;
  int s3 = m_station[2];
  s3 = ( s3 == 15 ) ? 0 : ((s3/2)%2)+1;
  int s4 = m_station[3];
  s4 = ( s4 == 15 ) ? 0 : ((s4/2)%2)+1;

  //  0 ... empty track segment
  //  1 ... same wheel 
  //  2 ... next wheel 
  
  if ( s1 == 0 && s2 == 0 && s3 == 0 && s4 == 0 ) code =  0;
  if ( s1 == 0 && s2 == 0 && s3 == 2 && s4 == 1 ) code =  0;
  if ( s1 == 0 && s2 == 0 && s3 == 2 && s4 == 2 ) code =  0;
  if ( s1 == 0 && s2 == 2 && s3 == 0 && s4 == 1 ) code =  0;
  if ( s1 == 0 && s2 == 2 && s3 == 0 && s4 == 2 ) code =  0;
  if ( s1 == 0 && s2 == 2 && s3 == 1 && s4 == 0 ) code =  0;
  if ( s1 == 0 && s2 == 2 && s3 == 2 && s4 == 0 ) code =  0;   
  if ( s1 == 0 && s2 == 1 && s3 == 2 && s4 == 1 ) code =  0; 
  if ( s1 == 0 && s2 == 2 && s3 == 1 && s4 == 1 ) code =  0;
  if ( s1 == 0 && s2 == 2 && s3 == 1 && s4 == 2 ) code =  0;
  if ( s1 == 0 && s2 == 2 && s3 == 2 && s4 == 1 ) code =  0;
  if ( s1 == 0 && s2 == 2 && s3 == 2 && s4 == 2 ) code =  0;  
  if ( s1 == 1 && s2 == 0 && s3 == 2 && s4 == 1 ) code =  0; 
  if ( s1 == 1 && s2 == 2 && s3 == 0 && s4 == 1 ) code =  0;
  if ( s1 == 1 && s2 == 2 && s3 == 1 && s4 == 0 ) code =  0; 
  if ( s1 == 1 && s2 == 1 && s3 == 2 && s4 == 1 ) code =  0; 
  if ( s1 == 1 && s2 == 2 && s3 == 1 && s4 == 1 ) code =  0;
  if ( s1 == 1 && s2 == 2 && s3 == 1 && s4 == 2 ) code =  0;
  if ( s1 == 1 && s2 == 2 && s3 == 2 && s4 == 1 ) code =  0;    
  if ( s1 == 0 && s2 == 0 && s3 == 1 && s4 == 1 ) code =  1;
  if ( s1 == 0 && s2 == 0 && s3 == 1 && s4 == 2 ) code =  2;
  if ( s1 == 0 && s2 == 1 && s3 == 0 && s4 == 1 ) code =  3;
  if ( s1 == 0 && s2 == 1 && s3 == 0 && s4 == 2 ) code =  4;
  if ( s1 == 0 && s2 == 1 && s3 == 1 && s4 == 0 ) code =  5;
  if ( s1 == 0 && s2 == 1 && s3 == 1 && s4 == 1 ) code =  6;
  if ( s1 == 0 && s2 == 1 && s3 == 1 && s4 == 2 ) code =  7;
  if ( s1 == 0 && s2 == 1 && s3 == 2 && s4 == 0 ) code =  8;
  if ( s1 == 0 && s2 == 1 && s3 == 2 && s4 == 2 ) code =  8;
  if ( s1 == 1 && s2 == 0 && s3 == 0 && s4 == 1 ) code =  9;
  if ( s1 == 1 && s2 == 0 && s3 == 0 && s4 == 2 ) code = 10;
  if ( s1 == 1 && s2 == 0 && s3 == 1 && s4 == 0 ) code = 11;
  if ( s1 == 1 && s2 == 0 && s3 == 1 && s4 == 1 ) code = 12;
  if ( s1 == 1 && s2 == 0 && s3 == 1 && s4 == 2 ) code = 13;
  if ( s1 == 1 && s2 == 0 && s3 == 2 && s4 == 0 ) code = 14;
  if ( s1 == 1 && s2 == 0 && s3 == 2 && s4 == 2 ) code = 14;
  if ( s1 == 1 && s2 == 1 && s3 == 0 && s4 == 0 ) code = 15;
  if ( s1 == 1 && s2 == 1 && s3 == 0 && s4 == 1 ) code = 16;
  if ( s1 == 1 && s2 == 1 && s3 == 0 && s4 == 2 ) code = 17;
  if ( s1 == 1 && s2 == 1 && s3 == 1 && s4 == 0 ) code = 18;
  if ( s1 == 1 && s2 == 1 && s3 == 1 && s4 == 1 ) code = 19;
  if ( s1 == 1 && s2 == 1 && s3 == 1 && s4 == 2 ) code = 20;
  if ( s1 == 1 && s2 == 1 && s3 == 2 && s4 == 0 ) code = 21;
  if ( s1 == 1 && s2 == 1 && s3 == 2 && s4 == 2 ) code = 21;
  if ( s1 == 1 && s2 == 2 && s3 == 0 && s4 == 0 ) code = 22;
  if ( s1 == 1 && s2 == 2 && s3 == 0 && s4 == 2 ) code = 22;
  if ( s1 == 1 && s2 == 2 && s3 == 2 && s4 == 0 ) code = 22;
  if ( s1 == 1 && s2 == 2 && s3 == 2 && s4 == 2 ) code = 22;

  return code;

}

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().