#include <L1MuDTWedgeSorter.h>
Public Member Functions | |
int | id () const |
return Wedge Sorter identifier (0-11) | |
L1MuDTWedgeSorter (const L1MuDTTrackFinder &, int id) | |
constructor | |
void | print () const |
print results after sorting | |
virtual void | reset () |
reset Wedge Sorter | |
virtual void | run () |
run Wedge Sorter | |
const std::vector< const L1MuDTTrack * > & | tracks () const |
return vector of muon candidates | |
virtual | ~L1MuDTWedgeSorter () |
destructor | |
Private Member Functions | |
bool | anyTrack () const |
are there any non-empty muon candidates in the Wedge Sorter? | |
void | runCOL (std::vector< L1MuDTTrack * > &) const |
run the Cancel Out Logic of the wedge sorter | |
Static Private Member Functions | |
static bool | neighbour (const L1MuDTSecProcId &spid1, const L1MuDTSecProcId &spid2) |
find out if two Sector Processors are neighbours in the same wedge | |
Private Attributes | |
const L1MuDTTrackFinder & | m_tf |
std::vector< const L1MuDTTrack * > | m_TrackCands |
int | m_wsid |
Wedge Sorter:
A Wedge Sorter receives 2 muon candidates from each of the 6 Sector Processors of a wedge and forwards the 2 highest rank candidates per wedge to the DT Muon Sorter
N. Neumeister CERN EP
Definition at line 47 of file L1MuDTWedgeSorter.h.
L1MuDTWedgeSorter::L1MuDTWedgeSorter | ( | const L1MuDTTrackFinder & | tf, |
int | id | ||
) |
constructor
Definition at line 52 of file L1MuDTWedgeSorter.cc.
References m_TrackCands.
: m_tf(tf), m_wsid(id), m_TrackCands(2) { m_TrackCands.reserve(2); }
L1MuDTWedgeSorter::~L1MuDTWedgeSorter | ( | ) | [virtual] |
bool L1MuDTWedgeSorter::anyTrack | ( | ) | const [private] |
are there any non-empty muon candidates in the Wedge Sorter?
Definition at line 179 of file L1MuDTWedgeSorter.cc.
References m_TrackCands.
Referenced by print().
{ vector<const L1MuDTTrack*>::const_iterator iter = m_TrackCands.begin(); while ( iter != m_TrackCands.end() ) { if ( *iter && !(*iter)->empty() ) return true; iter++; } return false; }
int L1MuDTWedgeSorter::id | ( | void | ) | const [inline] |
return Wedge Sorter identifier (0-11)
Definition at line 58 of file L1MuDTWedgeSorter.h.
References m_wsid.
{ return m_wsid; }
bool L1MuDTWedgeSorter::neighbour | ( | const L1MuDTSecProcId & | spid1, |
const L1MuDTSecProcId & | spid2 | ||
) | [static, private] |
find out if two Sector Processors are neighbours in the same wedge
Definition at line 249 of file L1MuDTWedgeSorter.cc.
References L1MuDTSecProcId::sector(), and L1MuDTSecProcId::wheel().
{ // neighbour definition: // wheel 1 : -2, -1, +1, +1, +2 // wheel 2 : -3, -2, -1, +2, +3 bool neigh = false; int sector1 = spid1.sector(); int wheel1 = spid1.wheel(); int sector2 = spid2.sector(); int wheel2 = spid2.wheel(); if ( sector1 == sector2 ) { if ( ( wheel1 == -2 && wheel2 == -3 ) || ( wheel1 == -1 && wheel2 == -2 ) || ( wheel1 == +1 && wheel2 == -1 ) || ( wheel1 == +1 && wheel2 == +2 ) || ( wheel1 == +2 && wheel2 == +3 ) ) neigh = true; } return neigh; }
void L1MuDTWedgeSorter::print | ( | void | ) | const |
print results after sorting
Definition at line 161 of file L1MuDTWedgeSorter.cc.
References anyTrack(), gather_cfg::cout, m_TrackCands, and m_wsid.
{ if ( anyTrack() ) { cout << "Muon candidates found in Wedge Sorter " << m_wsid << " : " << endl; vector<const L1MuDTTrack*>::const_iterator iter = m_TrackCands.begin(); while ( iter != m_TrackCands.end() ) { if ( *iter ) cout << *(*iter) << " found in " << (*iter)->spid() << endl; iter++; } } }
void L1MuDTWedgeSorter::reset | ( | void | ) | [virtual] |
reset Wedge Sorter
Implements L1AbstractProcessor.
Definition at line 148 of file L1MuDTWedgeSorter.cc.
References m_TrackCands.
{ vector<const L1MuDTTrack*>::iterator iter; for ( iter = m_TrackCands.begin(); iter != m_TrackCands.end(); iter++ ) { *iter = 0; } }
void L1MuDTWedgeSorter::run | ( | void | ) | [virtual] |
run Wedge Sorter
Reimplemented from L1AbstractProcessor.
Definition at line 76 of file L1MuDTWedgeSorter.cc.
References L1MuDTTrack::address(), gather_cfg::cout, L1MuDTTFConfig::Debug(), L1MuDTTrack::empty(), m_tf, m_TrackCands, m_wsid, runCOL(), L1MuDTTrackFinder::sp(), and L1MuDTSectorProcessor::track().
{ // get track candidates from Sector Processors vector<L1MuDTTrack*> wedgecands; wedgecands.reserve(12); int sector = m_wsid; for ( int wheel = -3; wheel <= 3; wheel++ ) { if ( wheel == 0 ) continue; L1MuDTSecProcId tmpspid(wheel,sector); for ( int number = 0; number < 2; number++ ) { const L1MuDTTrack* cand = m_tf.sp(tmpspid)->track(number); if ( cand && !cand->empty() ) { // remove tracks which where found in wheel 0 and // which didn't cross wheel boundaries (SP -1) bool reject = false; if ( wheel == -1 ) { reject = true; for ( int stat = 2; stat <= 4; stat++ ) { int adr = cand->address(stat); // check addresses : 0,1,4,5,8,9 (own wheel) if ( adr != 15 ) reject &= ( (adr/2)%2 == 0 ); } } if ( !reject ) wedgecands.push_back(const_cast<L1MuDTTrack*>(cand)); } } } // print input data if ( L1MuDTTFConfig::Debug(5) ) { cout << "Wedge Sorter " << m_wsid << " input: " << wedgecands.size() << endl; vector<L1MuDTTrack*>::const_iterator iter; for ( iter = wedgecands.begin(); iter != wedgecands.end(); iter++ ) { if (*iter ) (*iter)->print(); } } // print input data runCOL(wedgecands); // remove disabled candidates vector<L1MuDTTrack*>::iterator it = wedgecands.begin(); while ( it != wedgecands.end() ) { if ( *it && (*it)->empty() ) { wedgecands.erase(it); it = wedgecands.begin(); continue; } it++; } // sort candidates by pt and quality and copy the 2 best candidates partial_sort_copy( wedgecands.begin(), wedgecands.end(), m_TrackCands.begin(), m_TrackCands.end(), L1MuDTTrack::Rank() ); if ( L1MuDTTFConfig::Debug(4) ) { cout << "Wedge Sorter " << m_wsid << " output: " << endl; vector<const L1MuDTTrack*>::const_iterator iter; for ( iter = m_TrackCands.begin(); iter != m_TrackCands.end(); iter++ ) { if (*iter) (*iter)->print(); } } }
void L1MuDTWedgeSorter::runCOL | ( | std::vector< L1MuDTTrack * > & | ) | const [private] |
run the Cancel Out Logic of the wedge sorter
Definition at line 165 of file L1MuDTMuonSorter.cc.
References abs, gather_cfg::cout, L1MuDTTFConfig::Debug(), L1MuDTMuonSorter::neighbour(), hitfit::phidiff(), and w2.
Referenced by run().
{ // compare candidates which were found in nearby sectors and wheels // if 2 candidates have at least one track segment in common // disable the one with lower quality // compare addresses from stations 2, 3 and 4 typedef vector<L1MuDTTrack*>::iterator TI; for ( TI iter1 = cands.begin(); iter1 != cands.end(); iter1++ ) { if ( *iter1 == 0 ) continue; if ( (*iter1)->empty() ) continue; L1MuDTSecProcId sp1 = (*iter1)->spid(); int qual1 = (*iter1)->quality(); for ( TI iter2 = cands.begin(); iter2 != cands.end(); iter2++ ) { if ( *iter2 == 0 ) continue; if ( *iter1 == *iter2 ) continue; if ( (*iter2)->empty() ) continue; L1MuDTSecProcId sp2 = (*iter2)->spid(); int qual2 = (*iter2)->quality(); if (sp1 == sp2 ) continue; int topology = neighbour(sp1,sp2); if ( topology == -1 ) continue; int countTS = 0; for ( int stat = 2; stat <= 4; stat++ ) { int adr1 = (*iter1)->address(stat); int adr2 = (*iter2)->address(stat); if ( adr1 == 15 || adr2 == 15 ) continue; switch ( topology ) { case 1 : { if ( adr1 > 7 ) continue; if ( adr2 > 3 && adr2 < 8 ) continue; int adr_shift = ( adr2 > 7 ) ? -8 : 4; if ( adr1 == adr2+adr_shift ) countTS++; break; } case 2 : { if ( adr2 > 7 ) continue; if ( adr1 > 3 && adr1 < 8 ) continue; int adr_shift = ( adr2 > 3 ) ? -4 : 8; if ( adr1 == adr2+adr_shift ) countTS++; break; } case 3 : { if ( ( adr1 == 6 && adr2 == 0 ) || ( adr1 == 7 && adr2 == 1 ) || ( adr1 == 2 && adr2 == 8 ) || ( adr1 == 3 && adr2 == 9 ) ) countTS++; break; } case 4 : { if ( ( adr1 == 2 && adr2 == 4 ) || ( adr1 == 3 && adr2 == 5 ) || ( adr1 == 10 && adr2 == 0 ) || ( adr1 == 11 && adr2 == 1 ) ) countTS++; break; } case 5 : { if ( ( adr1 == 0 && adr2 == 8 ) || ( adr1 == 1 && adr2 == 9 ) || ( adr1 == 4 && adr2 == 0 ) || ( adr1 == 5 && adr2 == 1 ) ) countTS++; break; } case 6 : { if ( ( adr1 == 0 && adr2 == 4 ) || ( adr1 == 1 && adr2 == 5 ) || ( adr1 == 8 && adr2 == 0 ) || ( adr1 == 9 && adr2 == 1 ) ) countTS++; break; } default : break; } } if ( countTS > 0 ) { if ( qual1 < qual2 ) { if ( L1MuDTTFConfig::Debug(5) ) { cout << "Muon Sorter cancel : "; (*iter1)->print(); } (*iter1)->disable(); break; } else { if ( L1MuDTTFConfig::Debug(5) ) { cout << "Muon Sorter cancel : "; (*iter2)->print(); } (*iter2)->disable(); } } } } // if two candidates have exactly the same phi and eta values // remove the one with lower rank for ( TI iter1 = cands.begin(); iter1 != cands.end(); iter1++ ) { if ( *iter1 == 0 ) continue; if ( (*iter1)->empty() ) continue; int phi1 = (*iter1)->phi(); int pt1 = (*iter1)->pt(); int qual1 = (*iter1)->quality(); for ( TI iter2 = cands.begin(); iter2 != cands.end(); iter2++ ) { if ( *iter2 == 0 ) continue; if ( *iter1 == *iter2 ) continue; if ( (*iter2)->empty() ) continue; int phi2 = (*iter2)->phi(); int pt2 = (*iter2)->pt(); int qual2 = (*iter2)->quality(); int w1 = (*iter1)->getStartTSphi().wheel(); int w2 = (*iter2)->getStartTSphi().wheel(); int phidiff = (phi2 - phi1)%144; if ( phidiff >= 72 ) phidiff -= 144; if ( phidiff < -72 ) phidiff += 144; if ( abs(phidiff) < 2 && (w1 == w2) ) { int rank1 = 10 * pt1 + qual1; int rank2 = 10 * pt2 + qual2; if ( L1MuDTTFConfig::Debug(5) ) { cout << "========================================" << endl; cout << " special cancellation : " << endl; (*iter1)->print(); if ( rank1 < rank2 ) cout << "cancelled" << endl; (*iter2)->print(); if ( rank1 >= rank2 ) cout << "cancelled" << endl; cout << "========================================" << endl; } if ( rank1 >= rank2 ) (*iter2)->disable(); if ( rank1 < rank2 ) { (*iter1)->disable(); break; } } } } }
const std::vector<const L1MuDTTrack*>& L1MuDTWedgeSorter::tracks | ( | void | ) | const [inline] |
return vector of muon candidates
Definition at line 70 of file L1MuDTWedgeSorter.h.
References m_TrackCands.
Referenced by L1MuDTMuonSorter::run().
{ return m_TrackCands; }
const L1MuDTTrackFinder& L1MuDTWedgeSorter::m_tf [private] |
Definition at line 85 of file L1MuDTWedgeSorter.h.
Referenced by run().
std::vector<const L1MuDTTrack*> L1MuDTWedgeSorter::m_TrackCands [private] |
Definition at line 88 of file L1MuDTWedgeSorter.h.
Referenced by anyTrack(), L1MuDTWedgeSorter(), print(), reset(), run(), and tracks().
int L1MuDTWedgeSorter::m_wsid [private] |
Definition at line 86 of file L1MuDTWedgeSorter.h.