CMS 3D CMS Logo

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

L1MuDTMuonSorter Class Reference

#include <L1MuDTMuonSorter.h>

Inheritance diagram for L1MuDTMuonSorter:
L1AbstractProcessor

List of all members.

Public Member Functions

 L1MuDTMuonSorter (const L1MuDTTrackFinder &)
 constructor
int numberOfTracks () const
 return number of found muon candidates after sorter
void print () const
 print results after sorting
virtual void reset ()
 reset Muon Sorter
virtual void run ()
 run Muon Sorter
const L1MuDTTracktrack (int id) const
 return pointer to a muon candidate
const std::vector< const
L1MuDTTrack * > & 
tracks () const
 return vector of muon candidates
virtual ~L1MuDTMuonSorter ()
 destructor

Private Member Functions

void runCOL (std::vector< L1MuDTTrack * > &) const
 run the Cancel Out Logic of the muon sorter

Static Private Member Functions

static int neighbour (const L1MuDTSecProcId &spid1, const L1MuDTSecProcId &spid2)
 find out if two Sector Processors are neighbours

Private Attributes

const L1MuDTTrackFinderm_tf
std::vector< const L1MuDTTrack * > m_TrackCands

Detailed Description

DT Muon Sorter:

The DT Muon Sorter receives 2 muon candidates from each of the 12 Wedge Sorters and sorts out the 4 best (highest pt, highest quality) muons

Date:
2007/03/30 09:05:32
Revision:
1.3

N. Neumeister CERN EP

Definition at line 47 of file L1MuDTMuonSorter.h.


Constructor & Destructor Documentation

L1MuDTMuonSorter::L1MuDTMuonSorter ( const L1MuDTTrackFinder tf)

constructor

Definition at line 50 of file L1MuDTMuonSorter.cc.

References m_TrackCands.

                                                              :
      m_tf(tf), m_TrackCands() {

  m_TrackCands.reserve(4);
  
}
L1MuDTMuonSorter::~L1MuDTMuonSorter ( ) [virtual]

destructor

Definition at line 62 of file L1MuDTMuonSorter.cc.

                                    {

}

Member Function Documentation

int L1MuDTMuonSorter::neighbour ( const L1MuDTSecProcId spid1,
const L1MuDTSecProcId spid2 
) [static, private]

find out if two Sector Processors are neighbours

Definition at line 300 of file L1MuDTMuonSorter.cc.

References abs, L1MuDTSecProcId::sector(), and L1MuDTSecProcId::wheel().

Referenced by L1MuDTWedgeSorter::runCOL().

                                                              {

  // definition of valid topologies:

  //              E T A
  //        -----------------
  //   +
  //        ---               ---
  //   |   | 2 |             | 2 |
  // P |   |___|             |___|
  //   |    ---    ---    ---        ---
  // H |   | 1 |  | 1 |  | 1 |      | 1 |
  //   |   |___|  |___|  |___|      |___|
  // I |           ---                   ---
  //   |          | 2 |                 | 2 |
  //              |___|                 |___|
  //   -
  // result: 1      2        3          4         5    6  otherwise : -1

  int topology = -1;

  int sector1 = spid1.sector();
  int wheel1  = spid1.wheel();

  int sector2 = spid2.sector();
  int wheel2  = spid2.wheel();

  int sectordiff = (sector2 - sector1)%12;
  if ( sectordiff >= 6 ) sectordiff -= 12;
  if ( sectordiff < -6 ) sectordiff += 12;

  if ( abs(sectordiff) == 1 ) {

    if ( wheel1 == wheel2 ) topology = (sectordiff > 0) ? 1 : 2;
    if ( wheel1 == +1 && wheel2 == -1 )  topology = (sectordiff > 0) ? 5 : 6; 
    if ( ( wheel1 == -2 && wheel2 == -3 ) ||
         ( wheel1 == -1 && wheel2 == -2 ) ||
         ( wheel1 == +1 && wheel2 == +2 ) ||
         ( wheel1 == +2 && wheel2 == +3 ) ) topology = (sectordiff > 0) ? 3 : 4;
 
  }     
       
  return topology;     

}
int L1MuDTMuonSorter::numberOfTracks ( ) const [inline]

return number of found muon candidates after sorter

Definition at line 67 of file L1MuDTMuonSorter.h.

References m_TrackCands.

Referenced by print().

{ return m_TrackCands.size(); }
void L1MuDTMuonSorter::print ( void  ) const

print results after sorting

Definition at line 147 of file L1MuDTMuonSorter.cc.

References gather_cfg::cout, m_TrackCands, and numberOfTracks().

                                   {

  cout << endl;
  cout << "Muon candidates found by the barrel MTTF : "
       << numberOfTracks() << endl;
  vector<const L1MuDTTrack*>::const_iterator iter = m_TrackCands.begin();
  while ( iter != m_TrackCands.end() ) {
    if ( *iter ) cout << *(*iter) << endl;
    iter++;
  }
  cout << endl;

}
void L1MuDTMuonSorter::reset ( void  ) [virtual]

reset Muon Sorter

Implements L1AbstractProcessor.

Definition at line 133 of file L1MuDTMuonSorter.cc.

References m_TrackCands.

                             {

  m_TrackCands.clear();
  vector<const L1MuDTTrack*>::iterator iter;
  for ( iter = m_TrackCands.begin(); iter != m_TrackCands.end(); iter++ ) {
    *iter = 0;
  }

}
void L1MuDTMuonSorter::run ( void  ) [virtual]

run Muon Sorter

Reimplemented from L1AbstractProcessor.

Definition at line 74 of file L1MuDTMuonSorter.cc.

References gather_cfg::cout, L1MuDTTFConfig::Debug(), m_tf, m_TrackCands, runCOL(), L1MuDTWedgeSorter::tracks(), and L1MuDTTrackFinder::ws().

                           {

  // get track candidates from Wedge Sorters
  vector<L1MuDTTrack*> mycands;
  mycands.reserve(24);
  
  for ( int wedge = 0; wedge < 12; wedge++ ) {
    vector<const L1MuDTTrack*> wscand = m_tf.ws(wedge)->tracks();
    vector<const L1MuDTTrack*>::iterator iter = wscand.begin();
    while ( iter != wscand.end() ) {
      if ( *iter && !(*iter)->empty() ) 
        mycands.push_back(const_cast<L1MuDTTrack*>(*iter) );
      iter++;
    }
  }

  // print input data
  if ( L1MuDTTFConfig::Debug(4) ) {
    cout << "DT Muon Sorter input: "
         << mycands.size() << endl;
    vector<L1MuDTTrack*>::const_iterator iter;
    for ( iter = mycands.begin(); iter != mycands.end(); iter++ ) {
      if (*iter ) (*iter)->print();
    }
  }
 
  // run Cancel Out Logic
  runCOL(mycands);

  // remove disabled candidates
  vector<L1MuDTTrack*>::iterator it = mycands.begin();
  while ( it != mycands.end() ) {
    if ( *it && (*it)->empty() ) {
      mycands.erase(it);
      it = mycands.begin(); continue;
    }
    it++;
  } 

  // sort pt and quality
  stable_sort( mycands.begin(), mycands.end(), L1MuDTTrack::Rank() );

  // copy the best 4 candidates
  int number_of_tracks = 0;
  vector<L1MuDTTrack*>::const_iterator iter1 = mycands.begin();
  while ( iter1 != mycands.end() ) {
    if ( *iter1 && number_of_tracks < 4 ) {
      m_TrackCands.push_back(*iter1);
      number_of_tracks++;
    }
    iter1++;
  }  

}
void L1MuDTMuonSorter::runCOL ( std::vector< L1MuDTTrack * > &  ) const [private]

run the Cancel Out Logic of the muon sorter

Referenced by run().

const L1MuDTTrack* L1MuDTMuonSorter::track ( int  id) const [inline]

return pointer to a muon candidate

Definition at line 70 of file L1MuDTMuonSorter.h.

References errorMatrix2Lands_multiChannel::id, and m_TrackCands.

{ return m_TrackCands[id]; }
const std::vector<const L1MuDTTrack*>& L1MuDTMuonSorter::tracks ( void  ) const [inline]

return vector of muon candidates

Definition at line 73 of file L1MuDTMuonSorter.h.

References m_TrackCands.

{ return m_TrackCands; }

Member Data Documentation

Definition at line 85 of file L1MuDTMuonSorter.h.

Referenced by run().

std::vector<const L1MuDTTrack*> L1MuDTMuonSorter::m_TrackCands [private]

Definition at line 86 of file L1MuDTMuonSorter.h.

Referenced by L1MuDTMuonSorter(), numberOfTracks(), print(), reset(), run(), track(), and tracks().